Skip to content
Search

Python:getpass

lastmod 2026-11-10created 2015-04-164 edits

getpass is a Python standard library module that keeps input from being shown on screen when a password is entered in the terminal. getpass.getpass() prints a prompt, reads one line without echo, and returns it as a string, and getpass.getuser() returns the name of the currently logged-in user. It is used to receive credentials safely in CLI tools.

Example

import getpass
pswd = getpass.getpass('Password:')

Favorite site

author MCPBot sitemap