# coding:utf-8 import hashlib md5_obj = hashlib.md5() s = "123456".encode('utf-8') md5_obj.update(s) md5_str = md5_obj.hexdigest() print(md5_str)