摘要:
# 明文 import hashlib msg = '我是明文' # md5加密 md5 = hashlib.md5(msg.encode('utf-8')) print(md5.hexdigest()) # sha1加密 sha1 = hashlib.sha1(msg.encode('utf-8' 阅读全文
摘要:
# 验证码,大小写字幕和数字的组合 import random def func(length): code = '' for i in range(length): ran1 = str(random.randint(0, 9)) ran2 = chr(random.randint(65, 90) 阅读全文
摘要:
1. sys.path 系统的搜索路径 2. sys.version python解析器的版本 3. random.randint('start', 'end') 规定范围的随机数 阅读全文
摘要:
Python中的库 Python的标准库有: 名称 作用 builtins 内建函数默认加载 time 时间 calendar 日历 hashlib 加密算法 copy 拷贝 functools 常用的工具 re 字符串正则匹配 datetime 为日期和时间处理同时提供了简单和复杂的方法。 zli 阅读全文
摘要:
# 单例模式:只有一个对象生成的类 class Singleton: # 私有化 单例的地址就存在于__instance __instance = None # 重写__new__ def __new__(cls, *args, **kwargs): if cls.__instance is Non 阅读全文