擅长:python、mysql、java
<p>您可以使用<a href="http://lxml.de/cssselect.html" rel="nofollow">lxml.cssselector</a>选择单选按钮。在</p>
<pre><code>>>> import lxml.html
>>> from lxml.cssselect import CSSSelector
>>> str = """
... '<input type="radio" name="rd1" value="E" checked="checked" />Employee
... <input type="radio" name="rd2" value="o" />Other'
... """
>>> input_sel = CSSSelector('input[name="rd1"]')
>>> lx = lxml.html.fromstring(str)
>>> input_sel(lx)
[<InputElement b7e7665c name='rd1' type='radio'>]
</code></pre>