|  | 
 
| 
import random
x
马上注册,结交更多好友,享用更多功能^_^您需要 登录 才可以下载或查看,没有账号?立即注册  
 red = random.sample(range(1, 34), 6)
 blue = random.randint(1, 16)
 
 print("开奖结果是:", *red)
 print("特别号码是:", blue)
 
 print这两句可以解释一下吗?
 是按print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)来吗
 为什么red 前面加*
 
 
 本帖最后由 柿子饼同学 于 2021-7-5 19:35 编辑 
分别打印'开奖结果是'和red 
red前面有*是要解包哦
 复制代码>>> import random as r
>>> red = r.sample(range(1, 34), 6)
>>> red
[33, 22, 7, 13, 30, 16]
>>> print(red)
[33, 22, 7, 13, 30, 16]
>>> print(*red)
33 22 7 13 30 16
>>> 
 | 
 |