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

yipeiwu_com6年前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设计】。

相关文章

python3 webp转gif格式的实现示例

使用PIL库,python3安装需要使用 pip install pillow from PIL import Image import os import re imgP...

Python调用C/C++动态链接库的方法详解

本文以实例讲解了Python调用C/C++ DLL动态链接库的方法,具体示例如下: 示例一: 首先,在创建一个DLL工程(本例创建环境为VS 2005),头文件: //hello.h...

Python使用metaclass实现Singleton模式的方法

本文实例讲述了Python使用metaclass实现Singleton模式的方法。分享给大家供大家参考。具体实现方法如下: class Singleton(type): def...

Python类的定义、继承及类对象使用方法简明教程

Python编程中类的概念可以比作是某种类型集合的描述,如“人类”可以被看作一个类,然后用人类这个类定义出每个具体的人——你、我、他等作为其对象。类还拥有属性和功能,属性即类本身的一些特...

tensorflow estimator 使用hook实现finetune方式

为了实现finetune有如下两种解决方案: model_fn里面定义好模型之后直接赋值 def model_fn(features, labels, mode, params):...