Sublime Text 2 User Input Limitations
In Sublime Text 2, user input through functions like input() in Python or gets in Ruby is not supported by default. This can be frustrating when working with code that requires user interaction.
Solution: SublimeREPL
Fortunately, there is a workaround using a Sublime Text package called SublimeREPL. This package creates an interactive Python environment within Sublime Text, allowing you to run Python code and interact with it during execution.
Installing SublimeREPL
To install SublimeREPL, follow these steps:
Using SublimeREPL
To use SublimeREPL, once you have installed it:
>>> text = input('Enter something: ')
Setting SublimeREPL as Default Build System
To make SublimeREPL the default build system for Python files, follow these steps:
"build_systems": [{ "name": "Python REPL", "commands": [{ "command": "sublimerepl_run_in_tab" }] }]
With SublimeREPL installed and configured as the default build system, you can now enter user input within Sublime Text 2 and interact with your code during execution.
The above is the detailed content of How to Get User Input in Sublime Text 2?. For more information, please follow other related articles on the PHP Chinese website!