References:
When using the input function in Python to capture user inputs, we end up seeing the resulting value as the user types it (in this case "vanilla bean"):
fav_flavor = input("Please input your favorite icecream flavor: ")
#> Please input your favorite icecream flavor: vanilla beanBut what if we want to ask for more sensitive inputs, like secret passwords or credentials? We need a way to prevent them from showing up in the program's output.
We can hide a user-inputted value by using the getpass function instead of the input function. The getpass function will either hide the resulting value, or mask it using a key icon or series of asterisks:
from getpass import getpass
my_password = getpass("Please input your secret password: ")
#> Please input your secret password: 馃攽This is espectially helpful in Google Colab, so you can share your notebook's output without exposing your secret credentials:
