Advertisement
Guest User

Untitled

a guest
Sep 1st, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. # Format of each line is:
  4. # date\ttime\tstore name\titem description\tcost\tmethod of payment
  5. #
  6. # We want elements 2 (store name) and 4 (cost)
  7. # We need to write them out to standard output, separated by a tab
  8.  
  9. import sys
  10. import csv
  11. #from datetime import datetime
  12.  
  13. reader = csv.reader(sys.stdin, delimiter = "\t")
  14.  
  15. writer = csv.writer(sys.stdout, delimiter = "\t", quotechar = '"', quoting = csv.QUOTE_ALL)
  16.  
  17.  
  18. for line in reader:
  19.  
  20. if len(line) == 19:
  21. #continue
  22.  
  23. author_id = line[3]
  24. post_hour = line[8][11:13]
  25.  
  26. print "{0}\t{1}".format(author_id, post_hour)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement