sublime python3 输入换行不结束的方法

yipeiwu_com5年前Python基础

sublime编辑模式下,编译py文件,enter键后并没有打印,发现是sublime编译方式的问题,需要安装插件sublimeREPL。

#!/usr/bin/python3 
str = input("请输入: ") 
print(str) 

安装完之后,点击tool--sublimeREPL-- Python-- Python - RUN current file,就可以正常的编译,输入一行后打印

由于每次编译都需要这步操作,会很麻烦,可以设置快捷键:

点击Preferences--key Bindings,设置快捷键,本次设置的是f5,可以自行修改

[ 
{"keys": ["f5"],"command": "repl_open", 
"caption": "Python - RUN current file", 
"id": "repl_python_run", 
"mnemonic": "R", 
"args": { 
"type": "subprocess", 
"encoding": "utf8", 
"cmd": ["python", "-u", "$file_basename"], 
"cwd": "$file_path", 
"syntax": "Packages/Python/Python.tmLanguage", 
"external_id": "python", 
"extend_env": {"PYTHONIOENCODING": "utf-8"} 
} 
} 
] 

以上这篇sublime python3 输入换行不结束的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

Python使用PIL模块生成随机验证码

Python生成随机验证码,需要使用PIL模块,具体内容如下 安装: pip3 install pillow 基本使用 1. 创建图片 from PIL import Ima...

Python 列表的清空方式

情况列表的操作: del list[:] list=[] list[:]=[] def func(L): L....

利用python画出折线图

利用python画出折线图

本文实例为大家分享了python画折线图的具体代码,供大家参考,具体内容如下 # encoding=utf-8 import matplotlib.pyplot as plt fro...

详解Python3定时器任务代码

使用threading写的一个定时器任务demo: import time import sys import signal import datetime import threa...

解析Python中的变量、引用、拷贝和作用域的问题

解析Python中的变量、引用、拷贝和作用域的问题

在Python中,变量是没有类型的,这和以往看到的大部分编辑语言都不一样。在使用变量的时候,不需要提前声明,只需要给这个变量赋值即可。但是,当用变量的时候,必须要给这个变量赋值;如果只写...