Hi,
I would like to find a way to convert mathematical constants in txt format to csv format where each digit is it's own entry in the csv file.
Here is my coding so far, but I can't seem to get to work like I want to.
import csv
with open('constants/PiDec.txt','r') as rf:
with open('constants/PiDec.csv','a') as wf:
csv_writer = csv.writer(wf)
s_t_r = 1
i = 1
f_contents = rf.read(s_t_r)
while len(f_contents) > 0:
csv_writer.writerow(f_contents)
f_contents = rf.read(s_t_r)
rf.seek(i)
i = i+1
f_contents = rf.read(s_t_r)