January 2019
Beginner
318 pages
8h 23m
English
In this section, we are going learn about the getpass module to handle passwords at runtime. The getpass() module in Python prompts the user to enter a password without echoing. The getpass module is used to handle the password prompt whenever programs interact with a user through the Terminal.
We are going to see some examples of how to use the getpass module:
import getpasstry: p = getpass.getpass()except Exception as error: print('ERROR', error)else: print('Password entered:', p)
In this script, a prompt is not provided for the user. So, by default, it is set to the Password prompt.
Run the script as follows: ...
Read now
Unlock full access