Example #1
0
def getMergeTitle():
    rows=tablemerge.getTitles(dbconfig.mergetable, limit=5000)
    if rows !=-1:
        f_title_ori=open(merge1_title_file_ori,'w')
        with open(merge1_title_file,'w') as fout:
            for row in rows:
                # id,title,summary,ctime,source
                mtid,title,summary,ctime=row[0],row[1].strip(),re.sub('\s+','',row[2]),row[3]
                msg_t_ori='%s %s'%(mtid,title)
                title=delpunc(' '.join(jieba.cut(title)).lower()).encode('utf-8')                
                msg_t='%s %s'%(mtid,title)                
                print msg_t_ori
                fout.write(msg_t+'\n')     
                f_title_ori.write(msg_t_ori+'\n')
        f_title_ori.close()
Example #2
0
def getTimeSpan():
    rows=tablemerge.getTitles(dbconfig.mergetable, limit=5000)
    min_time,max_time=long(time.time()),0
    if rows !=-1:
        for row in rows:
            # id,title,summary,ctime,source
            mtid,title,summary,ctime=row[0],row[1].strip(),re.sub('\s+','',row[2]),row[3]
            if ctime > max_time:
                max_time=ctime
            if ctime < min_time:
                min_time=ctime
    print time.time()
    print min_time
    print max_time
    print time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(min_time)),'~',\
    time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(max_time))