尝试解析此html:
</thead>
<tbody>
<tr>
<td class="rank">
1.
</td>
<td class="name">
<a href="https://hoopshype.com/player/stephen-curry/salary/">
Stephen Curry </a>
</td>
<td style="color:black" class="hh-salaries-sorted" data-value="40231758">
$40,231,758 </td>
如何从这里拉“ color:black”?
答案 0 :(得分:1)
publishSubject
.debounce {
if (isFirst(it)) {
Observable.just(it)
} else {
Observable.just(it).delay(2, TimeUnit.SECONDS)
}
}
.observeOn(uiScheduler)
.subscribe({
onView { onRefreshEvent(it) }
}, {
onView { showError() }
}))
输出:
from bs4 import BeautifulSoup
data = """
</thead>
<tbody>
<tr>
<td class="rank">
1.
</td>
<td class="name">
<a href="https://hoopshype.com/player/stephen-curry/salary/">
Stephen Curry </a>
</td>
<td style="color:black" class="hh-salaries-sorted" data-value="40231758">
$40,231,758 </td>
"""
soup = BeautifulSoup(data, 'html.parser')
for item in soup.findAll('td', attrs={'class': 'hh-salaries-sorted'}):
print(item.get('style'))