sv.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:Random 作者: rkramesh 项目源码 文件源码
def csvFinalReview():
     print 'started'    
     with open('sorted.txt', 'r') as f:
         for line in f:
               line = line.strip('\n')
               durl='http://fisheye.com/cru/'+line+'/reviewHistory.csv'
               print durl
               testfile = urllib.URLopener()
               testfile.retrieve('http://fisheye.com/cru/'+line+'/reviewHistory.csv', line+'.csv')
               columns = defaultdict(list) # each value in each column is appended to a list
               with open(line+'.csv') as f:
                    reader = csv.DictReader(f) # read rows into a dictionary format
                    for row in reader: # read a row as {column1: value1, column2: value2,...}
                        for (k,v) in row.items(): # go over each column name and value
                            columns[k].append(v) # append the value into the appropriate list
                                                 # based on column name k

               d = dict(zip(zip(columns['Date'],columns['User'],columns['New value']),columns['Action']))
               for key, value in d.iteritems():
                    if value == 'COMMENT_CHANGED' or value == 'COMMENT_ADDED':
                        print file,key
                        try:
                            os.remove(line+'.csv')
                        except IOError:
                            pass







#csvComment()
#csvReview()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号