#!/usr/bin/python
f=open('/home/yanchao/test')
line=f.readline()
list=[]
def write_file(line):
c=open('file','a')
c.write(line)
while line:
list.append(line)
a=len(list)
if a = 5000:
for i in range(500):
b=random.randint(5000)
write_file(list[b])
list=[]
line=f.readline()
f.close()
转载于:https://blog.51cto.com/4249964/1438386