Skip to content
Browse files

doc tweaks and further simplify csv usage

  • Loading branch information...
1 parent c0a8d3c commit 15a627a31ef3a56d989b1e7868c18a21cea971dc @zstumgoren zstumgoren committed
Showing with 7 additions and 6 deletions.
  1. +6 −5 projects/fdic/save_to_csv.py
  2. +1 −1 projects/fdic/save_to_db.py
View
11 projects/fdic/save_to_csv.py
@@ -71,15 +71,16 @@ def convertdatestring(datestring):
except:
row[6] = ''
-filename = os.path.join(PROJECT_DIR, 'fdic.txt')
-# This is a Python idiom you'll see often.
+# Below are a few Python idioms you'll see often.
# You're opening a file so that you can read data from it.
-# Then, you use the csv module to help write the data to a file
-# http://docs.python.org/2/library/csv.html#csv.DictReader
+# Then, you use the csv module to help write data to the file.
+# http://docs.python.org/2/library/functions.html#open
+# http://docs.python.org/2/library/csv.html
+filename = os.path.join(PROJECT_DIR, 'fdic.txt')
with open(filename, 'wb') as outputfile:
- wtr = csv.writer(outputfile, delimiter='|', quotechar='"')
+ wtr = csv.writer(outputfile, delimiter='|')
# Add headers tooutput
wtr.writerow(headers)
View
2 projects/fdic/save_to_db.py
@@ -38,7 +38,7 @@
# Commit our change
conn.commit()
-# Get results data (recall that it's a list of two elements [headers, data]
+# Get results data (recall that it's a list of two elements [headers, data])
results = scrape_data()
data = results[1]

0 comments on commit 15a627a

Please sign in to comment.
Something went wrong with that request. Please try again.