Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import sys
- import csv
- import re
- reader = csv.reader(sys.stdin, delimiter = "\t")
- for line in reader:
- if len(line) == 19:
- title = line[1]
- tagnames = line [2]
- author_id = line[3]
- nodetype = line[5]
- parent_id = line[6]
- abs_parent_id = line[7]
- added_at = line[8]
- score = line[9]
- print "{0}\tB\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}".format(author_id,title,tagnames,nodetype,parent_id,abs_parent_id,added_at,score)
- if len(line) == 5:
- id = line[0]
- reputation = line[1]
- gold = line[2]
- silver = line[3]
- bronze = line[4]
- print "{0}\tA\t{1}\t{2}\t{3}\t{4}".format(id,reputation,gold,silver,bronze)
- import sys
- import csv
- reader = csv.reader(sys.stdin, delimiter = "\t")
- reputation = None
- gold = None
- silver = None
- bronze = None
- title = None
- tagnames = None
- nodetype = None
- parent_id = None
- abs_parent_id = None
- added_at = None
- score = None
- oldId = None
- for line in reader:
- id = line[0]
- #print "{0}\t{1}\t{2}".format(id, len(line), line[1])
- #if id and oldId != id:
- if line[1] == "A":
- #print "User data : {0}\t{1}\t{2}\t{3}".format(line[2], line[3], line[4], line[5])
- reputation = line[2]
- gold = line[3]
- silver = line[4]
- bronze = line[5]
- continue
- #if line[1] == "B":
- print "{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}".format(id,line[2], line[3], line[4], line[5], line[6], line[7], line[8], reputation,gold,silver,bronze)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement