Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide passwd and show ' * ' under Python

Tags:

python

I want to write a small project,it needs you to input your id and passwd,but i need a function to replace the passwd with '*' while you inputing passwd,i only know the raw_input() can input something,so i cannot solve the problem. how to write the function?

like image 963
evbo Avatar asked Feb 10 '23 15:02

evbo


1 Answers

Try this:

import getpass
pw = getpass.getpass()
like image 88
Hrvoje Avatar answered Feb 12 '23 04:02

Hrvoje