结合使用urllib2和urllib中的方法即可解决问题。这是我使用这两种方法发布数据的方式:
post_data = [('name','Gladys'),] # a sequence of two element tuplesresult = urllib2.urlopen('http://example.com', urllib.urlenpre(post_data))content = result.read()
urlopen()是用于打开URL的方法。
urlenpre()将参数转换为百分比编码的字符串。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)