-1
I’m learning to use webscraping in Python (version 3.7).
I’m dealing with regular expressions and writing this code:
from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
html = urlopen('http://www.pythonscraping.com/pages/pages3.html')
bsObj = BeautifulSoup(html, 'html.parser')
images = bsObj.findAll('img', {'src': re.compile("\.\./img/gifts/img.*\.jpg")})
for image in images:
print(image['src'])
Precisely on the following line images = bsObj.findAll('img', {'src': re.compile("\.\./img/gifts/img.*\.jpg")})
pycharm notifies me with the message 'PEP8 invalid escape Sequence'.
I would like you to help me understand and fix the possible mistake.
Try to format your code better to facilitate our reading, I will answer below my solution
– user175765