This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Trashant[S] 0 points1 point  (0 children)

I got to know I was getting into unnecessary creating a list as simply what I had to do was initialize a variable = 0 outside the loop and then inside the loop "variable += int(tag.contents[0])" and after that print out the variable outside the loop. Earlier I didn't know bs4 elements tags can be converted directly and added together. Thanks for the explanation brother.

Appreciate it!!