Discuss / Python / 作业一

作业一

Topic source
# -*- coding: utf-8 -*-
#__author='MoonCrazy'

db = {
    'michael': 'e10adc3949ba59abbe56e057f20f883e',
    'bob': '878ef96e86145580c38c87f0410ad153',
    'alice': '99b1c2188db85afee403b1536010c2c9'
}

user = input('请输入用户名')
password = input('密码')


def login(user, password):
    mdu = hashlib.md5()
    mdu.update(password.encode('utf-8'))
    if db[user] == mdu.hexdigest():
        print('登录成功')
    else:
        print('x')

login(user,password)

  • 1

Reply