【发布时间】:2018-11-02 19:03:10
【问题描述】:
编写一个名为“variable_get”的函数,该函数将字符串作为参数,表示 url 路径的一部分,并将 HTTPS GET 请求的响应作为字符串返回到 url“http://python.org/(input)”,其中 (input) 是该函数的输入参数。
import urllib2
def variable_get(input1):
content = urllib2.urlopen('http://python.org/input1').read()
return content
我的问题是如何在 HTTP GET 请求中正确设置 url 的输入参数?
【问题讨论】: