擅长:python、mysql、java
<p>要获取<code>element</code>的<code>attributes</code>,可以使用<code>.get()</code>方法(<code>python3</code>),即:</p>
<pre><code><A CLASS="someClass" uniqueID="someValue" anotherID="someOtherValue">
Here is the data I can scrape right now.
</A>
</code></pre>
<p></p>
<pre><code>_as = xmlSoup.find_all('a')
for a in _as :
print(a.get('CLASS'))
print(a.get('uniqueID'))
print(a.get('anotherID'))
print(a.text))
</code></pre>
<p>上面将循环html中的所有<code>a</code>标记,并打印每个标记的指定属性</p>