把登录封装到login.py里面了,别的没变。主要是那句sss=str(sss)救命了…………
# coding=utf-8 import urllib import urllib2 import cookielib import sys import poststatus import time import login from StringIO import StringIO def zhuanfa(): html=login.login() index=html.find('转自') #print html while index>=0: html=html[index:] index2=html.find('<p') sss=html[:index2] html=html[index2:] fw=open('zhuanfa.db','a') fr=open('zhuanfa.db','r') alllines=fr.readlines() #print sss sss=str(sss) fr.close() boo=1 for each in alllines: if sss.find(each[len(each)/2:len(each)/3*2])>0: boo=0 if boo==1: poststatus.zhuangtai('自动转发:'+sss) fw.write('n'+sss+'n') print 'n已存'+sss else: pass #print '发现转发过的状态' index=html.find('转自')
发表回复