I'm scraping a page and from a table on that page I'm getting all <tr>
elements like so:
r = requests.get("http://lol.esportswikis.com/wiki/G2_Esports/Match_History")
s = BeautifulSoup(r.content, "lxml")
tr = s.find_all("table", class_="wikitable sortable")[0].find_all("tr")[3:]
print tr[0]
which outputs:
<tr style="background-color:#C6EFCE"><td>...</td> ... <td>...</td></tr>
Now I'm trying to get the style of the <tr>
tag, but I have no idea how. If I do this for example:
for item in tr[0]:
print item
it obviously just prints the <td> ... </td>
stuff. I'm thinking I can probably do something like print tr[0].something
, like tr[0].tag
, but everything I've tried so far hasn't resulted in what I want.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…