`
san_yun
  • 浏览: 2600334 次
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

python 乱序

 
阅读更多
from random import shuffle, choice
file  = open("username","r")
content = []
for read in file.readlines():
    read = read.strip().lstrip()
    content.append(read)

shuffle(content)

print choice(content))

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics