0

Controlling what is being typed in the console?

Is there any way to control what is being typed in the console in python? For instance, let us say I prompted the user for a password using input(). What I want is that as the user types in the console, either asterisks or no string is displayed in the console but the input is still read and can be processed. How it currently looks like in the console: >>>a=input(”Input your password\n") Input your password 123456 #a is '123456' How I want it to look like >>>a=input(”Input your password\n") Input your password ****** #a is '123456' Or even better >>>a=input(”Input your password\n") Input your password #a is '123456 Probably there is something in the 'sys' or 'os' library which can be manipulated to achieve this.

22nd Dec 2018, 3:47 PM
Mayur Garg
Mayur Garg - avatar
1 ответ