Skip to main content
 首页 » 编程设计

python之输入后 VS Code 不处理 python 打印命令

2024年10月24日8EasonJim

下面的 python 代码在 Visual Studio 和 Python IDLE 中运行良好。但是当我在 VISUAL STUDIO CODE 中编写它时,输入值之后的所有 4 个打印命令都没有被处理。

print ('hello world')  
print ('hello world')  
message = raw_input ('type message ')  
print ('message')  
print ('statement 1')  
print ('statement 2')  
print ('statement 3')  
print ('statement 4')  

例如,当我在输入中填写“我的消息”时,它只是打印:

hello world 
hello world 
type message  
my message 

并且不执行输入后的 4 个打印命令。 预期的输出将是:

hello world 
hello world 
type message  
my message 
statement 1 
statement 2 
statement 3 
statement 4 

知道为什么 Visual Studio Code 不处理剩余的 4 个打印命令吗?

请您参考如下方法:

它在我的 VS 上运行良好。我认为您正在尝试做的一件事是使用此命令打印用户输入。

打印('消息')

原来是这样

打印信息