Python常用函数

1.Python choice() 函数

import random

print "choice([1, 2, 3, 5, 9]) : ", random.choice([1, 2, 3, 5, 9])
print "choice('A String') : ", random.choice('A String')

输出结果

choice([1, 2, 3, 5, 9]) :  2
choice('A String') :  n

 

posted @ 2017-06-18 19:15  ~沐风  阅读(215)  评论(0编辑  收藏  举报