you loginsuccessfully!
eg:修改ex1.py
#!/usr/bin/env python
# _*_ coding = utf-8 _*_
import getpass
name = raw_input('please inputyour username:')
pwd = getpass.getpass('inputyour password:')
print 'the name is:',name
print 'the password is:',pwd
if name == 'huwei' and pwd =='huwei123':
print 'you login successfully!'
else:
print 'your password is wrong!'
执行结果:
#!/usr/bin/envpython
# _*_ coding =utf-8 _*_
import getpass
name =raw_input('please input your username:')
pwd =getpass.getpass('input your password:')
print 'the nameis:',name
print 'thepassword is:',pwd
if name =='huwei' and pwd == 'huwei123':
print 'you login successfully!'
以上就是详解Python输入和 输出的详细内容,更多请关注Gxl网其它相关文章!
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did85700