-1

I am using BeautifulSoup to scrape a page with a table. When I am going to download some images inside that table using a for loop and "urlretrieve", I am not able to give each image a different name, thus the each time an image is downloaded, it is replaced by a new image because they have the same name.

In other words, I am not able to change a variable inside a string so that I can give each downloaded image a different name.

enter image description here

enter image description here

enter image description here

finefoot
  • 9,914
  • 7
  • 59
  • 102
Diego
  • 386
  • 4
  • 19

1 Answers1

0

From your last picture, you are setting num to 0 at each loop iteration. You want to take it out of the loop.

for ...
  num=0

to

num = 0
for ...
  num += 1
Untitled123
  • 1,317
  • 7
  • 20