How to use getpass library in python

401 Views Asked by At

I'm trying to use getpass library in python but I can't. Can somebody help me to use it in vscode?

I tried:

Getpass import as input

but it didn't work.

2

There are 2 best solutions below

0
Alon Alush On

Use the correct Python syntax for importing the getpass module:

import getpass

We don't need to import the input function from a module because it is a built-in function in Python 3 versions.

0
crissal On

There is no input name in the getpass library; you can find the docs here: https://docs.python.org/3/library/getpass.html

This is an example of usage:

import getpass

user = input("Username: ")
password = getpass.getpass("Password: ")
# do something with these credentials