Exemple #1
0
def begin():
    db = DBService(dbName='jddata', tableName='thirdPartShopInfo')
    data = db.getData()
    title = db.getTableTitle()[1:-2]
    S = set()
    for item in data:
        S.add(tuple(item[1:-2]))
    data = []
    for item in S:
        data.append(list(item))
    csv = CSV()
    csv.writeCsv(savePath='D:/spider', fileTitle=title, data=data, fileName='jdData')
Exemple #2
0
def sumCommentCount():
    db = DBService(dbName='jddata', tableName='thirdPartShopInfoAddCommnetCount')
    # db = DBService(dbName='jddata', tableName='thirdPartShopInfoAddtest')
    data = db.getData(var='shopName,commnetCount')
    dict = {}
    for item in data:
        if item[0] in dict.keys():
            dict[item[0]] = int(item[1]) + dict[item[0]]
        else:
            dict[item[0]] = int(item[1])
    data = []
    for item in dict.items():
        data.append([item[0], item[1]])
    csv = CSV()
    csv.writeCsv(savePath='D:/spider', fileTitle=['shopName', 'commnetCount'], data=data, fileName='jdDataSum')
Exemple #3
0
__author__ = '613108'
from ms_spider_fw.CSVService import CSV

C=CSV()
# C.csv2one(filePath=r'D:\spider\tmall\20150921',fileNameType=0)
data=C.getData(filePath=r'D:\spider\tmall\20150921')
S={}
for item in data:
    if item[1] in S.keys():
        S[item[1]]+=1
    else:S[item[1]]=1
data=[item for item in data if item[1] in S]
# data=[item for item in ]
C.writeCsv(savePath=r'D:\spider\tmall\20150921',data=data,fileName='TOTAL')