urlretrieve a file whose name has spaces in it
kevin at cazabon.com
Thu Jul 31 02:31:27 CEST 2003
You can easily escape spaces with "%20"
foo.doc".replace(" ", "%20"), "local_file")
hp at rentec.com (HP) wrote in message news:<10caf2e2.0307291439.33d9fcc3 at posting.google.com>...
> I am using urllib.urlretrieve() to download a file from a web site.
> THe trouble is that the file name has spaces in it,
> such as "string string1 foo.doc".
> The statement:
> urllib.urlretrieve("http://website.com/path/string string1 foo.doc",
> produces local_file which contains the following one line:
> <html><head><title>Error</title></head><body>The parameter is
> incorrect. </body></html>
> What is the correct way of specifying the this file in urlretrieve() ?
More information about the Python-list