0
How to take input password ?
i mean like when we enter our password anywhere it appears as "*" . how can i take input like that?
7 Respuestas
+ 5
You can use 'getpass' module for that. It doesn't show characters when typing:
import getpass
pwd = getpass.getpass('Enter your password: ')
print('You set your password to:', pwd)
+ 5
Then I think you have to write your own implementation with msvcrt or curses module (depending on your OS).
https://docs.python.org/3/library/msvcrt.html
https://docs.python.org/3.6/library/curses.html
+ 5
@N0ob only via code comments for now :)
+ 1
In a window or a terminal ?
In a window, just do your own entry bar
In a terminal, well .... I do not know ... set the terminal in no waiting for user input, and each time the user enter a character, enter \r ' ' so that you remove it
I know how to do it in C on unix systems but not in Python
0
@Kuba I've tried that getpass... but it just makes whatever we write invisible. What i wanted to do is to make it look like '*****'.