[問題] urllib2的有沒有request有什麼不同

看板Python作者 (我只是QQ糖)時間15年前 (2010/03/17 11:33), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/1
我原本看到的範例是這樣 # import urllib2 response = urllib2.urlopen('http://python.org/') html = response.read() # 這跟urllib的作法一樣 可是我又看到這個 # import urllib2 req = urllib2.Request('http://www.voidspace.org.uk') response = urllib2.urlopen(req) the_page = response.read() # 請問一下多了這個req有什麼差別阿? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.119.232.58

03/17 11:59, , 1F
urllib2.Request Object 可以addheader
03/17 11:59, 1F

03/18 02:09, , 2F
OKAY,那我大概知道了,感謝您^^
03/18 02:09, 2F
文章代碼(AID): #1Be4sM2F (Python)
文章代碼(AID): #1Be4sM2F (Python)