python提取list中的数字

 时间:2026-05-01 15:08:09

1、打开新文件

打开python编辑器,点击“File—New file”

python提取list中的数字

2、输入代码

import random 

list1 = [1, 2, 3, 4]

a = random.choice(list1) 

print(a)

python提取list中的数字

3、保存代码

点击“Run-Run Module”保存代码

python提取list中的数字

4、运行代码

保存后,每次运行,就会随机提取list中的一个数字

python提取list中的数字

  • python创建列表
  • python大小写字母转换
  • 如何将python中的列表转换成字符串
  • python字符串逆序输出
  • python一次性输入n个数
  • 热门搜索
    左胸口疼是怎么回事 怎么做课件 打印机墨盒怎么取出 无聊用英语怎么说 怎么样去黑头 怎么撸管最爽 手脚麻木是怎么回事 妇科炎症怎么治 上海东华大学怎么样 衬衣怎么洗