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
原文地址:https://www.cnblogs.com/cnki/p/7045023.html