This is my python code.
r = requests.get("myurl")
data = r.text
soup = BeautifulSoup(data, "lxml")
texttmp = ""
for link in soup.find_all('a'):
image = link.get("href")
if ".jpg" in image:
print(image)
When I try to run this code, I am getting below error. How can I fix this?
TypeError Traceback (most recent call last)
<ipython-input-35-618698d3a2d7> in <module>()
11 for link in soup.find_all('a'):
12 image = link.get("href")
---> 13 if ".jpg" in image:
14 print(image)
15
TypeError: argument of type 'NoneType' is not iterable