Python's Way "first": Python Basics (3)

Source: Internet
Author: User
Tags stdin

Import Getpass[[email protected] ~]# cat Test_getpass.pyimport getpassusername = input ("username:") password = Getpass.getpass ("Password:") print (Username,password) [[email protected] ~]# Python3 Test_getpass.pyusername:jam Password:jam Hello[[email protected] ~]# C:\users\jam>python2python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5, 20:40:30) [MSC v.1500-bit (AMD64)] on Win32typ E "Help", "copyright", "credits" or "license" for more information.>>> import getpass>>> username = Inpu T ("username:") username:jamtraceback (most recent call last): File "<stdin>", line 1, in <module> file "<s Tring> ", line 1, in <module>nameerror:name ' jam ' isn't defined>>> username = raw_input (" username: ") use rname:jam>>> Password = getpass.getpass ("Password:") password:>>> print (Username,password) (' Jam ', ' hello123 ') >>> C:\users\jam>pythonpython 3.5.1 (v3.5.1:37a07cee5969, Dec 6, 01:54:25) [MSC v.1900-bit (AMD64)] on Win32type " Help "," copyright "," credits "or" license "for more information.>>> username = input (" username: ") username:jam& gt;>> Password = getpass.getpass ("Password:") Traceback (most recent call last): File ' <stdin> ', line 1, in &L T;module>nameerror:name ' Getpass ' is not defined>>> import getpass>>> username = input ("Username:" ) username:jam>>> password = getpass.getpass ("Password:") password:>>> print (Username,password) jam Hello123>>> #!/usr/bin/env python
#-*-Coding:utf-8-*-

#pycharm里面无法使用getpass方法, it works on Linux and Windows Python
Import Getpass
Username = input ("username:")
Passwrod = Getpass.getpass ("Password:") print (Username,passwrod) 

Python's Way "first": Python Basics (3)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.