7
我想刮一個帶有BeautifulSoup 4.4.0的標籤名稱在camelCase和find_all似乎無法找到它們的XML文件。示例代碼:find_all with CamelCase標籤名稱與BeautifulSoup 4
from bs4 import BeautifulSoup
xml = """
<hello>
world
</hello>
"""
soup = BeautifulSoup(xml, "lxml")
for x in soup.find_all("hello"):
print x
xml2 = """
<helloWorld>
:-)
</helloWorld>
"""
soup = BeautifulSoup(xml2, "lxml")
for x in soup.find_all("helloWorld"):
print x
我得到的輸出是:
$ python soup_test.py
<hello>
world
</hello>
什麼是查找駱駝套管/大寫的標籤名稱的正確方法是什麼?