Oct-29-2019, 10:09 PM
(Oct-29-2019, 09:29 PM)fioranosnake Wrote: Hi, I there a straight forward way to write the pprint output to a text file?
with open('numb.csv') as f,open('out.csv', 'w') as f_out: #next(f) # If need to skip header data = [i.strip() for i in f] data = dict(enumerate(data, 1)) for k,v in data.items(): f_out.write(f'{k}: {v}\n')
Output:1: 1231241231
2: 1235135135
3: 5457345345
4: 4577865568
5: 8654563848