使用getpass模块

#!/usr/bin/env python
import getpass
username = raw_input("username:")
password = getpass.getpass("password:")    #第一个getpass是模块名,第二个getpass是模块里面的函数

if username == 'bob' and password == '123456':
print 'Login successful'
else:
print 'Login incorrect'

 

相关文章:

  • 2022-01-27
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2022-01-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
相关资源
相似解决方案