Reputation: 15
I have written a Python3 script which downloads a URL. However, it does not work if there is an "umlaut" in the URL (in this case "ü"). The URL does not work if I write "ue". How can I change to UTF 8?
import urllib.request
url = "https://www.corona-in-zahlen.de/landkreise/sk%20würzburg/"
urllib.request.urlretrieve(url, "webpage.txt")
Upvotes: 0
Views: 117
Reputation: 38
Your example works if you replace the ü with a regular u:
import urllib.request
url = "https://www.corona-in-zahlen.de/landkreise/sk%20wurzburg/"
urllib.request.urlretrieve(url, "webpage.txt")
Upvotes: 2