Background:
Read the txt document after an experiment, convert it to csv format, and then draw the CDF
For example: read delay.txt and convert to data.csv.
out = open('data.csv', 'w', newline='') #必须指定 newline=’’, 否则每插入一行就有一个空行
csv_writer = csv.writer(out, dialect='excel')
with open('delay.txt',"r") as f:
for line in f.readlines():
list = line.split()
csv_writer.writerow(list)