Beautiful Soup 4 CSS selector does not work the same way the tutorial show

后端 未结 1 1093
北海茫月
北海茫月 2021-01-20 15:50

I run the sample CSS selector codes from [Beautiful Soup 4 tutorial page][1], but the results are different, some give the correct result, some do not. In the websi

相关标签:
1条回答
  • 2021-01-20 16:29

    I've figured out your problem. You are using a version of BeautifulSoup that is older than 4.3.2.

    I just had 4.1.2 installed, and I ran your code. I had the same problem, I got an empty list, now that I've updated it to 4.3.2, I get the list of siblings again.

    You can install it via pip, but you can also get the latest version from Pypi and download it.

    0 讨论(0)
提交回复
热议问题