大学MOOC Python网络爬虫程序技术(湖南三一工业职业技术学院)1450324342 最新慕课完整章节测试答案
项目1爬取学生信息
GETPOST
1、单选题:
服务器程序可以接受get与post的提交信息import flaskapp=flask.Flask(__name__)@app.route("/",____________________)def index(): try: province=flask.request.values.get("province") if "province" in flask.request.values else "" city = flask.request.values.get("city") if "city" in flask.request.values else "" note = flask.request.values.get("note") if "note" in flask.request.values else "" return province+","+city+"n"+note except Exception as err: return str(err)if __name__=="__main__": app.run()缺失的语句是
选项:
A: methods=["GET","POST"]
B: method=["GET","POST"]
C: methods=["POST"]
D: method=["POST"]
答案: 【 methods=["GET","POST"] 】
POST
1、单选题:
编程客户端client.py程序如下:import urllib.parseimport urllib.requesturl="http://127.0.0.1:5000"try: province= urllib.parse.quote("广东") city= urllib.parse.quote("深圳") data="province="+province+"&city="+city ___________________________ ____________________________ html = html.read() html = html.decode() print(html)except Exception as err: print(err)服务器server.py程序import flaskapp=flask.Flask(
