Python 3 issue with re
Python 3 interprets string literals as Unicode strings, and therefore \s is treated as an escaped Unicode character. Declare RegEx pattern as a raw string instead by prepending r
This commit is contained in:
parent
d84d02349c
commit
62d81b7610
1 changed files with 1 additions and 1 deletions
|
|
@ -418,7 +418,7 @@ def extract_images_from_html(doc, content):
|
|||
return '<img src="{file_url}"'.format(file_url=file_url)
|
||||
|
||||
if content:
|
||||
content = re.sub('<img[^>]*src\s*=\s*["\'](?=data:)(.*?)["\']', _save_file, content)
|
||||
content = re.sub(r'<img[^>]*src\s*=\s*["\'](?=data:)(.*?)["\']', _save_file, content)
|
||||
|
||||
return content
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue