Can i get console input without echo in python?
Question:
Can I get console input without echo in python?
Answers:
Use getpass:
>>> from getpass import getpass
>>> getpass()
Password:
'secret'
Maybe the ‘console’ module is your only bet (it’s kinda ‘fork’ of the curses module for Unix), however I haven’t seen anything related to terminal echo disabling in its homepage, you might try to dig into it by yourself.
There is also another solution (at least on unix systems, I don’t know if this is working on Windows). Simply switch off the console output and use raw_input:
os.system("stty -echo")
password = raw_input('Enter Password:')
os.system("stty echo")
print "n"
Can I get console input without echo in python?
Use getpass:
>>> from getpass import getpass
>>> getpass()
Password:
'secret'
Maybe the ‘console’ module is your only bet (it’s kinda ‘fork’ of the curses module for Unix), however I haven’t seen anything related to terminal echo disabling in its homepage, you might try to dig into it by yourself.
There is also another solution (at least on unix systems, I don’t know if this is working on Windows). Simply switch off the console output and use raw_input:
os.system("stty -echo")
password = raw_input('Enter Password:')
os.system("stty echo")
print "n"