سؤال

Fabric includes the prompt() operation to collect input from the user:

fabric.operations.prompt(text, key=None, default='', validate=None)

At one point, I ask the user for a password:

pw = prompt('Password:')

When the user types his password, it's displayed in the shell in plain text. Is it possible to keep the user's input hidden?

هل كانت مفيدة؟

المحلول

http://docs.python.org/2/library/getpass.html

getpass.getpass('Password: ')
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top