python 获取随机字母

方法一(使用string):

1 import string
2 import random
3 
4 s = string.ascii_letters
5 r = random.choice(s)
6 print(r)

 

方法二(使用ch())

import random

s  = random.randint(65,90)
r = ch(s)

print(r)

 

posted @ 2017-05-24 14:28  郭雪原  阅读(11694)  评论(0编辑  收藏  举报