中国天气网:
http://www.weather.com.cn/data/sk/101020100.html
颜色处为城市代码,在输入框中输入对应城市,就可以在html中看到对应的城市代码
import requests r = requests.get('http://www.weather.com.cn/data/sk/101020100.html') r.encoding = 'utf-8' print r.json()['weatherinfo']['city'], r.json()['weatherinfo']['WD'], r.json()['weatherinfo']['temp']