Answers for "input character in python like getchar in c"

0

input character in python like getchar in c

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)
Posted by: Guest on August-04-2021

Python Answers by Framework

Browse Popular Code Answers by Language