#!/usr/bin/env python
# -*- coding: cp936 -*-
#2010-3-25
#python 测试与应用:41357415
#深圳IT招聘求职:105095215
#武冈深圳高级群:66250781
#因为我现在还有找到在大量文件查找python实现的好方法。
#实现采用了grep的方法。
#使用了os.popen而不是subprocess中的Popen,因为前者的参数更简单
#不知subprocess中的Popen是否有更好的地方?
#gtalk: xurongzhong#gmail.com
import re
import time
import random
import sys
import os
for line in open("smu.csv"):
line = line.strip()
attr = line.split(',')
docid = attr[0]
isu_spam_rank = attr[1]
isu_quality_rank = attr[2]
isu_PornRank = attr[3]
isu_PoliticRank = attr[4]
strings = "grep " + docid + " spamRank.20.dat.csv"
f = os.popen(strings)
data = f.readline()
f.close()
if data :
value = data.strip().split(',')[1]
if int(value) == int(isu_spam_rank):
pass
else:
print docid +"**value**isu_spam_rank**" + value + "--------" + isu_spam_rank
print "error"
for line in open("smu.csv"):
line = line.strip()
attr = line.split(',')
docid = attr[0]
isu_spam_rank = attr[1]
isu_quality_rank = attr[2]
isu_PornRank = attr[3]
isu_PoliticRank = attr[4]
strings = "grep " + docid + " qualityRank.20.dat.csv"
f = os.popen(strings)
data = f.readline()
f.close()
if data :
value = data.strip().split(',')[1]
if int(value) == int(isu_quality_rank):
pass
else:
print docid +"**value**isu_quality_rank**" + value + "--------" + isu_quality_rank
print "error"
for line in open("smu.csv"):
line = line.strip()
attr = line.split(',')
docid = attr[0]
isu_spam_rank = attr[1]
isu_quality_rank = attr[2]
isu_PornRank = attr[3]
isu_PoliticRank = attr[4]
strings = "grep " + docid + " pornRank.20.dat.csv"
f = os.popen(strings)
data = f.readline()
f.close()
if data :
value = data.strip().split(',')[1]
if int(value) == int(isu_PornRank):
pass
else:
print docid +"**value**isu_PornRank**" + value + "--------" + isu_PornRank
print "error"
f.close
阅读(32209) | 评论(0) | 转发(0) |