# Txt to CSV conversion

I would like to convert mathematical constants in txt format to csv format where each digit is its own entry in the csv file.

Here is my code so far, which does not do what I want.

```
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)
```

Can you give a simplified small example of what

`PiDec.txt`

contains and what you want`PiDec.csv`

to look like?First of all I can't call up the full txt. It is Pi to the millionth digit. So I have to call the individual digit, and place each individual digit in it's own cell.

I would eventually like to create a csv database with a bunch of mathematical constants that are all the way out to the millionth digit.