python - Python 输入函数在 VS Code 中不起作用
问题描述
balance = 100
print('Current Balance: ', balance)
while balance > 0:
print('1. WITHDRAW')
print('2. DEPOSIT')
choice = input("Select an option... ")
if (choice == 1):
print('1')
elif (choice == 2):
print('2')
else:
print('test')
当我使用代码运行器扩展程序运行代码时,代码会显示在终端中,但是当它到达输入函数时,它会冻结,就像它要求我输入一些数据一样,但是我不能输入数字或字母。
这是终端显示的...
[Running] python -u "c:\Users\bowen\Desktop\CSE 120\PROJECT 3\main.py"
Current Balance: 100
1. WITHDRAW
2. DEPOSIT
Select an option...
解决方案
Code Runner在 OUTPUT 中显示结果,默认情况下不接受输入。添加
"code-runner.runInTerminal": true
在 Settings.json 中,然后您可以输入数据。
推荐阅读
- python - RuntimeWarning:在 true_divide W = 1/sigma**2/s_sq symfit 中遇到除以零
- python - 根据其值更改 numpy 数组的各个元素
- python - tf.train.init_from_checkpoint 不初始化使用 tf.Variable 创建的变量
- c# - iTextSharp 5 - 如何转换 HTML 元素
- video-streaming - 记录RTC | 我们可以在不停止记录的情况下保存 blob 数据吗
- java - 二维数组中的真值表
- function - 重构箭头函数以兼容 IE
- android-studio - Android Studio 3.3.1 中关于 Github 的 Update Project 和 Pull 命令有什么不同?
- webserver - 使用 Esp8266 传递强制门户
- android - Retrofit2:adapter-rxjava 证书问题