我需要帮助解决问题...我正在编写代码以了解标签的内容,但是...如果内容有 id,我该怎么做?
from bs4 import BeautifulSoup
import urllib2
code = '<span class="vi-is1-prcp" id="v4-27"> 15,00 EUR </span>'
soup = BeautifulSoup(code)
price = soup.find('a', id='v4-27') # <-- PROBLEM
print price
我需要帮助解决问题...我正在编写代码以了解标签的内容,但是...如果内容有 id,我该怎么做?
from bs4 import BeautifulSoup
import urllib2
code = '<span class="vi-is1-prcp" id="v4-27"> 15,00 EUR </span>'
soup = BeautifulSoup(code)
price = soup.find('a', id='v4-27') # <-- PROBLEM
print price