在这里插入代码片import urllib.request
import json
import string
while True:
target=r’http://api.qingyunke.com/api.php?key=free&appid=()&msg=’
keyword = input(“user:”)#user是你给人机取的名字
if keyword == “txit”: # 只能输入文本型
print(“不过如此”)
break
tmp =target + keyword
url = urllib.parse.quote(tmp,safe=string.printable)
page = urllib.request.urlopen(url)
html = page.read().decode(“utf-8”) # utf-8编码格式
res =json.loads(html)
print(res[‘content’])
05-14
3744
11-15