Skip to main content
The 2024 Developer Survey results are live! See the results

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • 13
    This won't work if there are spaces in the url you provide. In that case, you'll need to parse the url and urlencode the path. Commented Apr 14, 2010 at 21:17
  • 118
    Here is the Python 3 solution: stackoverflow.com/questions/7243750/… Commented Feb 25, 2014 at 12:09
  • 7
    Just for reference. The way to urlencode the path is urllib2.quote Commented Aug 2, 2014 at 2:09
  • 11
    @JasonSundram: If there are spaces in it, it isn't a URI.
    – Zaz
    Commented Oct 1, 2015 at 2:51
  • 1
    This does not work on windows with larger files. You need to read all blocks!
    – Avia
    Commented Oct 10, 2016 at 22:47