Advertisement
Guest User

Matthew Holloway

a guest
Oct 20th, 2010
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. #!/usr/bin/python2.6
  2. import sys
  3. fields = [["Email","EMAIL"],["Name1","FIRSTNAME"],["Name2","LASTNAME"],["Title","TITLE"],["Date","DATE"]]
  4. row_template = {}
  5. for field in fields:
  6.   print field[1],",",
  7.   row_template[field[0]] = ""
  8. print ""
  9. row = {}
  10. while True:
  11.   line = sys.stdin.readline()
  12.   if not line: break
  13.   elif line.find(":") == -1: continue
  14.   field = line[0:line.find(":")]
  15.   if field in row_template.keys():
  16.     row[field]=line[line.find(":")+1:].strip()
  17.     if len(row) == len(fields):
  18.         for field in fields:
  19.             print row[field[0]],",",
  20.         print ""
  21.         row = {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement