Python Memory Issue with BeautifulSoup

后端 未结 2 1785
旧巷少年郎
旧巷少年郎 2021-01-25 17:35

I\'ve resolved this issue, but I\'m wondering why it was caused in the first place. I used BeautifulSoup to identify this span from a webpage:

span = 

        
2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-25 18:12

    Probably because str(span.contents) is calling the __str__ function inside the object span.contents and returning a smaller representation. You can use the pympler to measure the memory consumption

提交回复
热议问题