RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

云南昆明网站维护公司

昆明网站建设、网站设计制作、网站运营维护常见知识介绍
python3学习之random
import random

print(random.random())  #随机取值
print(random.randint(1,4))  #随机从1到4去一个整数,包含1和4
print(random.choice([1,2,3,4]))  #随机从列表中选一个,返回字符串
print(random.choices([1,2,3]))  #随机从列表中选一个,返回list
print(random.randrange(1,4))  #随机从1到4去一个整数,包含1和不包含4
print(random.sample([1,2,3],2))  #随机从列表中选2个,返回list
print(random.uniform(1,5))  #返回return a + (b-a) * self.random()

当前题目:python3学习之random
转载源于:http://www.bdklh.com/article/jpjhcc.html