Skip to content

Instantly share code, notes, and snippets.

@namnv609
Created February 3, 2016 03:59
Show Gist options
  • Save namnv609/f462c194e80ed4048cd2 to your computer and use it in GitHub Desktop.
Save namnv609/f462c194e80ed4048cd2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import argparse, getpass
class Password(argparse.Action):
def __call__(self, parser, namespace, values, option_string):
if values is None:
values = getpass.getpass()
setattr(namespace, self.dest, values)
parser = argparse.ArgumentParser('Test password parser')
parser.add_argument('-p', action=Password, nargs='?', dest='password', help='Enter your password')
args = parser.parse_args()
print args.password
@mallireddysateesh
Copy link

hai please help me how to display information of sensors in the form of text in place of graphical represntation

@William-Lake
Copy link

Thank you for posting this, saved me some time.

@chhex
Copy link

chhex commented Sep 15, 2021

Doesn't work and formatting is also wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment