Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python2.6
- import sys
- fields = [["Email","EMAIL"],["Name1","FIRSTNAME"],["Name2","LASTNAME"],["Title","TITLE"],["Date","DATE"]]
- row_template = {}
- for field in fields:
- print field[1],",",
- row_template[field[0]] = ""
- print ""
- row = {}
- while True:
- line = sys.stdin.readline()
- if not line: break
- elif line.find(":") == -1: continue
- field = line[0:line.find(":")]
- if field in row_template.keys():
- row[field]=line[line.find(":")+1:].strip()
- if len(row) == len(fields):
- for field in fields:
- print row[field[0]],",",
- print ""
- row = {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement