#-*- coding:utf-8 -*-
import sys
reload(sys)
#sys.setdefaultencoding("gbk")
from re import findall
import requests
import re
from urllib import urlopen
from bs4 import BeautifulSoup
def modifyip(tfile,sstr,rstr):
try:
lines=open(tfile,'r').readlines()
flen=len(lines)-1
for i in range(flen):
if sstr in lines[i]:
lines[i]=lines[i].replace(sstr,rstr)
open(tfile,'w').writelines(lines)
except Exception,e:
print e
url = 'http://mp.weixin.qq.com/s/d2dOqNN1ITxN3pSr0VP3uQ'
content = urlopen(url).read()
f1 = file('p.htm','wb')
f1.write(content)
f1.close()
#f2=file('pic.txt','wb')
import os
import math
altxt = open('p.htm').read()
pattern = '|',altxt)
f1 = file('p1.htm','a+')
for i in listpp:
print listpp.index(i)
if (listpp.index(i)+2)%2 == 0:
print i
f1.write(i)
f1.close()
altxt = open('p1.htm').read()
pattern = '