📌  相关文章
📜  从文件python代码示例中获取随机行

📅  最后修改于: 2022-03-11 14:45:03.696000             🧑  作者: Mango

代码示例1
import random
lines = open('file.txt').read().splitlines() # creates a list with one line per iteù
randomLine =random.choice(lines) # pick up a random item in this list