Spaces:
Running
Running
File size: 559 Bytes
9791162 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import random
if __name__ == "__main__":
all_items = []
fo = open("./files/train_all.txt", "r+", encoding='utf-8')
while (True):
try:
item = fo.readline().strip()
except Exception as e:
print('nothing of except:', e)
break
if (item == None or item == ""):
break
all_items.append(item)
fo.close()
random.shuffle(all_items)
fw = open("./files/train_all.txt", "w", encoding="utf-8")
for strs in all_items:
print(strs, file=fw)
fw.close()
|