简体   繁体   中英

Problem with terminating input function of python in sublime text 3

Thank you if you are reading this and for help me.

I wrote a python script in sublime text 3, which uses a input function to take string and to display it using a print function.

I run the script with ctr + B, input command executed, now I write a string and hit enter. Cursor goes in next line and input function did not terminated.

Help me to solve this problem. Thank you.

Sublime Text does not support inputting data into a program .

How to solve this problem

  • Create a build system that first opens a terminal and then runs your program inside of the terminal
  • Use SublimeREPL to run your code in Sublime
  • Use Terminus in your build system; it allows you to create an actual interactive terminal directly within Sublime.

I would generally recommend Terminus for this; it's very easy

Quick Solution outside sublime :

  • can use separate cmd(Windows) or Terminal(Mac/Linux) python name_file.py

Click the Sublime Text icon to launch it, or search for Sublime Text in your system's search bar and then launch it. Go to Tools Build System4 New Build System, which will open a new configuration file for you. Delete what you see and enter the following:

{
 "cmd": ["python3", "-u", "$file"],
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM