Last change
on this file since 3529 was
3529,
checked in by adiwidjaja, 16 years ago
|
Working import/export.
|
-
Property svn:eol-style set to
native
|
File size:
302 bytes
|
Rev | Line | |
---|
[3527] | 1 | import csv |
---|
| 2 | |
---|
| 3 | def readFile(f): |
---|
| 4 | """read a CSV file""" |
---|
| 5 | headers = [] |
---|
| 6 | rows = [] |
---|
| 7 | f = csv.reader(f) |
---|
| 8 | headers = f.next() |
---|
| 9 | for line in f: |
---|
| 10 | rows.append(line) |
---|
| 11 | return (headers, rows) |
---|
| 12 | |
---|
| 13 | def writeFile(data): |
---|
| 14 | writer = csv.writer(open("export.csv", "wb")) |
---|
| 15 | writer.writerows(data) |
---|
Note: See
TracBrowser for help on using the repository browser.