|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
# -*- coding: utf-8 -*-
import urllib
import json
def getHtml(url):
page = urllib.urlopen(url)
html = page.read()
return html
if __name__ == '__main__':
key = '8b005db5f57556fb96dfd98fbccfab84'
api = 'http://www.tuling123.com/openapi/api?key=' + key + '&info='
while True:
info = raw_input('我: ')
request = api + info
response = getHtml(request)
dic_json = json.loads(response)
print ('机器人: ').decode('utf-8') + dic_json['text']
报错info = raw_input('我: ')
NameError: name 'raw_input' is not defined |
|