-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
beginnings of another basic CSV parsing script
- Loading branch information
1 parent
4e8ab78
commit 71789cc
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Below is a bare-bones example showing how to read data from a CSV. | ||
We combine a "for" loop with the "open" function to read each line | ||
and add it to a list. | ||
The "open" function accepts a number of extra options, but in | ||
in its most basic form can simply be called with the path to a file. | ||
""" | ||
# A list to store our data points | ||
data_store = [] | ||
|
||
# Loop through lines, do some basic clean up, and | ||
# add data to our data_store | ||
for line in open('data/banklist.csv'): | ||
clean_line = line.strip() | ||
data_points = clean_line.split(',') | ||
data_store.append(data_points) | ||
|
||
for line in data_store: | ||
print line |