使用vs code進行Python編程,如何進行input輸入?

如圖,當要輸入時,我在控制台中輸入數字5,然後按下回車,程序不會往下走,還能繼續輸入數字。

是我操作的姿勢不對嗎?很小白的問題,就匿了。


https://github.com/DonJayamanne/pythonVSCode/wiki/Capture-User-Input-via-input()-or-raw_input()


左上角的下拉選擇調試模式中,常用的兩個是Python和Integrated Terminal/Console,第一個就是在插件自帶的環境中調試運行,第二個就是集成的控制台中。問題是,第一種暫不支持input()輸入,所以想調試帶input的程序,換成External Terminal是可以的。


我昨天剛問就被刪了,不知道為什麼,現吐槽一下貴乎的行事作風,

建議你閱讀一下官方文檔,有相關介紹,我給你複製下:

Node console#

By default, Node.js debug sessions launch the target in the internal VS Code Debug Console. Since the Debug Console does not support programs that need to read input from the console, you can enable either an external terminal_ or use the VS Code Integrated Terminal by setting the console attribute in your launch configuration to externalTerminal or integratedTerminal respectively. The default is internalConsole.

If an external terminal is used, you can configure which terminal program to use via the terminal.external.windowsExec, terminal.external.osxExec, and terminal.external.linuxExec settings.


直接在終端運行就行啊


我今天也遇到了,我以為 我程序有問題,麻蛋


推薦閱讀:

為什麼Sublime Text不支持Python交互?
Python中一個創建樹結構的方法。
Python 類組合(composition)和聚合(aggregation)
有哪些學習氛圍比較不錯的 Python 論壇?

TAG:Python | VisualStudioCode |