Posts

Showing posts with the label passwords

Masking user input in python with asterisks

Image
Masking user input in python with asterisks I am trying to mask what the user types into IDLE with asterisks so people around them can't see what they're typing/have typed in. I'm using basic raw input to collect what they type. key = raw_input('Password :: ') Ideal IDLE prompt after user types password: Password :: ********** You will have to do some custom stdout redirection to mask with asterisks, but there is an easier way to get passwords stackoverflow.com/a/1761753/1268926 – Kedar Dec 24 '14 at 5:01 3 Answers 3 Depending on the OS, how you get a single character from user input and how to check for the carriage return will be different. See this post: Python read a single character from the user On OSX, for example, you coul...