Trouble with User Inputs in Sublime Text [duplicate]

旧街凉风 提交于 2019-12-12 02:23:20

问题


I'm trying to code a simple calculator using Python (2) in Sublime Text that consists of asking the user for the first number, the operation, then the second number. However, every time I try to execute the code in Sublime, I can't get past the first user input.

num1 = int(raw_input("Enter your first number:"))
operation = raw_input("Enter your operation:")
num2 = int(raw_input("Enter your second number:"))

This works in IDLE, i.e. I hit enter after I enter a number and it prompts for an operation. Is there a different way to do this in Sublime?


回答1:


Sublime text doesn't support input from the console, it's just an out console, anyways there's a way around, you can use SublimeREPL. You get a full IDLE like console embedded right into the sublime text!

Quotting what you get:

Launch python in local or remote(1) virtualenv.

Quickly run selected script or launch PDB.

Use SublimeText2 Python console with history and multiline input.

You can install it from package control(I guess you already have package control! If not get it from here).



来源:https://stackoverflow.com/questions/38176401/trouble-with-user-inputs-in-sublime-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!