📜  在 python 中输入字符,如 c 中的 getchar - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:45.195000             🧑  作者: Mango

代码示例1
import sys
str = ""
while True:
    c = sys.stdin.read(1) # reads one byte at a time, similar to getchar()
    if c == ' ':
        break
    str += c
print(str)