또 하 나 는 날씨 스 크 립 트.
""" """
import re,urllib,urllib2
s='http://search.weather.com.cn/static/url.php'
body={}
n=raw_input('please input your local street tel number: ')
print '
'
body['cityinfo']=n
ss=urllib.urlencode(body)
tem=urllib.urlopen(s,ss).read()
url=re.findall(r'URL=(.*?)">',tem)[0]
tem=urllib.urlopen(url).read()
w=open('weather.html','w')
w.write(tem)
w.close()
com=re.compile(r'<dt class="date">(.*?)<span class="f888">.*?<h3><strong>(.*?)<\/strong>\((.*?)\)<\/h3>.*?<dt>( )<\/dt>.*?<dd><strong>.*?<a>(\d*)<\/a>',re.I|re.M|re.S)
temp=com.findall(tem)
for i in temp:
for j in i:
t=unicode(j,'utf8','ignore')
print t,
com=re.compile(r'<div class="box_contenttodayinwea" id="c_1_1">(.*?) ',re.I|re.M|re.S)
temp=com.findall(tem)
for i in temp:
print '
'
ch=u' '
print ch,
com=re.compile(r'>(.*?)<',re.I|re.M|re.S)
t=com.findall(i)
for j in t:
j=j.strip()
tt=j.replace('\t','')
tt=tt.replace(' ','')
tt=unicode(tt,'utf8','ignore')
print tt,
com=re.compile(r'<div class="fut_weatherbox7">(.*?)<\/div>',re.I|re.M|re.S)
temp=com.findall(tem)
for i in temp:
print '
'
com=re.compile(r'>(.*?)<',re.I|re.M|re.S)
t=com.findall(i)
for j in t:
tt=j.replace('\t','')
tt=tt.strip()
tt=tt.replace(' ','')
tt=unicode(tt,'utf8','ignore')
print tt,
n=raw_input('
finished')
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다른 사람의 웹사이트 편집: contenteditable 및 designMode그래도 우리가 그렇게 할 수 있다고 생각하는 것은 멋진 일입니다. 제가 강조하고 싶었던 일종의 관련 API가 실제로 몇 개 있기 때문에 오늘 그것을 가져왔습니다. contenteditable는 "true" 값이 할당...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.