Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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)
Comment

PREVIOUS NEXT
Code Example
Python :: discard method in python 
Python :: OneToMany 
Python :: how to make a function input optional in python 
Python :: how to read comment before the root element of xml python 
Python :: python break out of function 
Python :: df.isna percentage 
Python :: how to store only the first and last item of a list in variable python 
Python :: if ele in python 
Python :: reminder application with notification in python 
Python :: stack overflow pop item from list in python 
Python :: Print Multiple Variables 
Python :: python for infinite range 
Python :: list data structure in python 
Python :: heapq basic push and pop - default minHeap 
Python :: Python check if caps lock is pressed 
Python :: method 01 of making GUI with tkinter in python 
Python :: generate a random string with lowercase uppercase and numbers 
Python :: python math.factorial algorithm 
Python :: Location of INSTALLED_APP and MIDDLEWARE 
Python :: python yield async await 
Python :: python error bars 
Python :: how to print tic tac toe border on terminal in python 
Python :: python script to open google chrome 
Python :: Strings Formatting Old Way 
Python :: python count down advanced 
Python :: jupyter notebook print formatted text 
Python :: python import only one function 
Python :: internet spam 
Python :: torch.cuda.randn 
Python :: scatter plot actual vs predicted python 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =