Beautiful Soup Find - get just the text

前端 未结 3 1471
一向
一向 2021-01-22 19:34

I had this bit of code spitting out just the price as a string (125.01), but I must have changed something because now it prints the whole line with the html tags and everything

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-22 20:15

    Sometimes I've found that .text or .get_text() return an empty string and I have to use:

    print(price.contents[0])

    I think it has to do with unicode vs bytes being returned.

提交回复
热议问题