python - how to download file by urllib2.urlopen -


i know how download simple file urrlib2.urlopen

but end url not simple has special character in :

" www.math.ualberta.ca/mss/misc/a mathematician's apology.pdf "

special character mathematician's ' in path

some how know

http://www.math.ualberta.ca/mss/misc/a%20mathematician%27s%20apology.pdf

is url have use download file if don't have kind of end url me every time

please give me solution can download file has special url

i have basic method can used don't know how use

  1. urllib.quote(string[, safe])
  2. urllib.quote_plus(string[, safe])
  3. urllib.unquote(string)
  4. urllib.unquote_plus(string)

please me method example

thank

why not use this?

filename = url.split('/')[-1] cleanurl = urllib.quote(url) urllib.urlretrieve(cleanurl, filename) 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -