urlretrieve試圖訪問其名稱包含UTF-8字符從瀏覽器中我得到的錯誤發送UTF-8 ADRESS在Python
The requested URL /images/0/04/×¤×ª×¨×•× ×•×ª_תרגילי×_על_משטחי×_×「יפ'_2014.pdf was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.`
爲了訪問這些文件我寫了下面的python腳本文件:
# encoding: utf8
__author__ = 'Danis'
__date__ = '20/10/14'
import urllib
curr_link = u'http://math-wiki.com/images/0/04/2014_\'דיפ_משטחים_על_פתרונות.nn uft8pdf'
urllib.urlretrieve(link, 'home/danisf/targil4.pdf')
但是當我運行的代碼我得到的錯誤URLError:<curr_link appears here> contains non-ASCII characters
我怎樣才能修復代碼,讓他工作? (順便說一下,我無法訪問服務器或網站管理員)也許瀏覽器失敗不是因爲文件名稱的錯誤編碼?
那麼,404是你的預期結果? – falsetru 2014-10-20 13:10:11
不,我想獲取文件。接收名爲「ex20-2014.pdf」的文件可以在瀏覽器中正常工作。我想得到這個文件,因爲我認爲這個html頁面中的某些東西被GET損壞了。 – 2014-10-20 13:13:29
您可以下載哪些原始網址? – falsetru 2014-10-20 13:15:43