import random #import导入,random随机数模块
a=random.random() #0到1随机取值b=random.choice(["张三","李艾","王五"]) #列表里面随机点名print(a)print(b)#引入模块内单一方法,(或多个:逗号加方法名)
from random import choice,randomc=choice(["张三","李艾","王五","马武"])print(c) #引入模块所有上方法from random import *本文共 306 字,大约阅读时间需要 1 分钟。
import random #import导入,random随机数模块
a=random.random() #0到1随机取值b=random.choice(["张三","李艾","王五"]) #列表里面随机点名print(a)print(b)#引入模块内单一方法,(或多个:逗号加方法名)
from random import choice,randomc=choice(["张三","李艾","王五","马武"])print(c) #引入模块所有上方法from random import *转载于:https://www.cnblogs.com/lma0702/p/11109464.html