As for me, the solution is as following (python3):
resource = urllib.request.urlopen(an_url)
content = resource.read().decode(resource.headers.get_content_charset())
More Related Contents:
- Does “\d” in regex mean a digit?
- How can I percent-encode URL parameters in Python?
- How to understand regular expression with python?
- urllib2.HTTPError: HTTP Error 403: Forbidden
- Replace non-ASCII characters with a single space
- Python regex matching Unicode properties
- How to retrieve the values of dynamic html content using Python
- How can I remove text within parentheses with a regex?
- python re.sub group: number after \number
- Handling backreferences to capturing groups in re.sub replacement pattern
- Python: URLError:
- Character reading from file in Python
- Python regular expressions – how to capture multiple groups from a wildcard expression?
- Python URLLib / URLLib2 POST
- Named regular expression group “(?Pregexp)”: what does “P” stand for?
- Capturing group with findall?
- Strip / trim all strings of a dataframe
- Python – RegEx for splitting text into sentences (sentence-tokenizing) [duplicate]
- Re.match() returns always none
- How to use regular expression in lxml xpath?
- Read a base 64 encoded image from memory using OpenCv python library
- Python regular expression for HTML parsing
- Remove Sub String by using Python
- How does python and the regex module handle backslashes?
- How to tell if one regular expression matches a subset of another regular expression?
- no module named urllib.parse (How should I install it?)
- Python: Replace with regex
- Remove non-ASCII characters from a string using python / django
- How to strip whitespace from before but not after punctuation in python
- Issue with regex backreference in Python