replace special characters in a string python
问题 I am using urllib to get a string of html from a website and need to put each word in the html document into a list. Here is the code I have so far. I keep getting an error. I have also copied the error below. import urllib.request url = input("Please enter a URL: ") z=urllib.request.urlopen(url) z=str(z.read()) removeSpecialChars = str.replace("!@#$%^&*()[]{};:,./<>?\|`~-=_+", " ") words = removeSpecialChars.split() print ("Words list: ", words[0:20]) Here is the error. Please enter a URL: