代码改变世界

Python random string

2017-12-28 11:57  Weiweim  阅读(1244)  评论(0编辑  收藏  举报
import random
import string


def random_str(len):
    letters = string.ascii_lowercase
    return ''.join(random.choice(letters) for x in range(len))

username = random_str(6)
name = "username=%s" %(username)
print(name)