需要微信的itchat库,若没有的老铁,先:
pip install itchat
若速度太慢,先在
点击这里,找到itchat库
下载后,再cmd:
pip install C:\a\b\itchat.whl #所在文件的绝对路径
安装完成后,代码,如下,话不多说,改个你所在的城市和微信好友,直接运行即可。
import json
import requests
import itchat
import urllib.request
from bs4 import BeautifulSoup
def jitang():
url='http://open.iciba.com/dsapi/'
r=requests.get(url)
all=json.loads(r.text)
chinese=all['content']
english=all['note']
soup=english+'\n'+chinese
return soup
def get_weather(city_pinyin):
header = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64;\
rv:23.0) Gecko/20100101 Firefox/23.0'}
website = "http://www