add by zhj: 在Python文档中清楚的说明了默认参数是怎么工作的,如下 "Default parameter values are evaluated when the function definition is executed. This means that the expression is evaluated once, when the function is defined, and that the same “pre-computed” value is used
Python 获取MD5加密值方法封装 import hashlib def get_md5(s): """获取MD5加密值 :param s: 需要加密的字符串 :return: 密文 """ if s: m = hashlib.md5() if s is str: m.update(s.encode("UTF-8")) else: m.update(str(s).encode("UTF-8")) ret