csv - python beginner questions -
i installed python
i trying run script:
import csv reader = csv.reader(open("some.csv", "rb")) row in reader: print row
i running on windows.
- do have type each line individually python shell or can save code text file , run shell?
- where some.csv have in order run it? in same c:\python26 folder?
- what code supposed do?
you can both! run code text file (such 'csvread.py', extension doesn't matter), type:
python csvread.py
@ command prompt. make sure path set include python installation directory."some.csv" needs in current directory.
this code opens python file descriptor designed read csvs. reader file descriptor prints out each row of csv in order. check documentation out more detailed example: http://docs.python.org/library/csv.html
Comments
Post a Comment