本文共 326 字,大约阅读时间需要 1 分钟。
Python3
import string # 导入string这个模块 print(string.digits) # 输出包含数字0~9的字符串 print(string.ascii_letters) # 包含所有字母(大写或小写)的字符串 print(string.ascii_lowercase) # 包含所有小写字母的字符串 print(string.ascii_uppercase) # 包含所有大写字母的字符串
import randomlst=[]for j in range(10): #生成10个随机英文小写字母 lst.append(random.choice(string.ascii_lowercase))
转载地址:http://gyoof.baihongyu.com/