在 Pascal 中,我可以执行此代码以从键盘输入中获取字符:
uses crt;
var ch: char;
begin
ch := '.';
while ch <> '\' do
begin
ch := readkey;
writeln( ch );
end;
end;
Python 中有类似的吗? :)
最佳答案
import sys
def prog():
char = ""
while char != "/":
char = sys.stdin.read(1)
print char
prog()
关于python - 如何在 Python 中获取类似于 Pascal readkey 的字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4799165/