Permalink
Browse files

Import ConfigParser and cosmetic fixes

  • Loading branch information...
1 parent 468bbcc commit 291faf2d8ff3fb2ee1b8cfa1671ddb8e16ac81fa @rubys committed Aug 2, 2007
Showing with 5 additions and 4 deletions.
  1. +5 −4 planet/csv_config.py
View
@@ -1,3 +1,4 @@
+from ConfigParser import ConfigParser
import csv
# input = csv, output = ConfigParser
@@ -10,17 +11,17 @@ def csv2config(input, config=None):
config = ConfigParser()
reader = csv.DictReader(input)
- for entry in reader:
- section = entry[reader.fieldnames[0]]
+ for row in reader:
+ section = row[reader.fieldnames[0]]
config.add_section(section)
- for name, value in entry.items():
+ for name, value in row.items():
if value and name != reader.fieldnames[0]:
config.set(section, name, value)
return config
if __name__ == "__main__":
- # small main program which converts OPML into config.ini format
+ # small main program which converts CSV into config.ini format
import sys, urllib
config = ConfigParser()
for input in sys.argv[1:]:

0 comments on commit 291faf2

Please sign in to comment.