How I can hide input symbols in python? P.S. example: When inputing password in input(" ") | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How I can hide input symbols in python? P.S. example: When inputing password in input(" ")

For security

1st Aug 2020, 4:02 PM
Muhammed
Muhammed - avatar
2 Answers
+ 4
intranet there are ways to do it. Actually there are many, but they might not match your needs 1. getpass: https://www.geeksforgeeks.org/getpass-and-getuser-in-JUMP_LINK__&&__python__&&__JUMP_LINK-password-without-echo/ Limitation: registers the input, but totally hides it from the screen. Means you won't see any action on the screen 2. If you want to display the password when it is being entered but hide it after pressing enter, see this https://stackoverflow.com/questions/52079846/how-to-hide-input-in-python-3-6/52080046 Limitation: platform-specific 3. The last option is using the curses library. With it, you can get exactly what you want and do much more like add strings to any part of the screen, register key presses etc. https://docs.python.org/3/howto/curses.html Limitation: it is quite complicated and requires a considerable amount of code. Also, you can't use many python functions like print, input. You need to read input by registering key presses and write output using the library
1st Aug 2020, 5:28 PM
XXX
XXX - avatar
+ 4
If you're asking for console based python, it is not possible. If it using any GUI library like tkinter,kivy, etc. You can find on google for specific library
1st Aug 2020, 4:11 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar