python随机读取文件中的某行字符Learn CategoryEQ19 3 月, 2018 10:08 上午评论(0)需要的库有random,linecache 代码如下: import random,linecache def random_line(filename): a = random.randrange(1,10) theline = linecache.getline(filename,a) return theline