Forum Archive

Reading data file (.csv)

Lulazo

I am a newbie to python and pythonista with a very small experience on programming. I wrote a very simple python program that can read a .csv file that is located in my computer. Now, I would like to implement it in pythonista, so my question is: where will be the best place to locate that (csv) file so it can be read from pythonista? Should I use the dropbox module or there is better option for this. Thanks.

ccc

In the Pythonista editor, create a new "Plain Text File" and name it my_file.csv and paste your csv content into it.

import csv
with open('my_file.csv') as in_file:
    for row in csv.reader(in_file):
        print ', '.join(row)
Lulazo

Thank you.