标签:string ice choice rand logs range blog class and
1、模块
ascii_letters和digits
import string,random def get_str(num,length=4): for i in range(num): str = [random.choice(string.ascii_letters + string.digits) for _ in range(length)] st = "".join(str) yield st lis = get_str(10) for i in lis: print i
标签:string ice choice rand logs range blog class and
原文地址:http://www.cnblogs.com/waylon/p/7465864.html