pyquery
pyquery copied to clipboard
has not support eq(index) string in filter selector?
it is found that .eq(index) selector works well as a outer selctor ,but not in filter string. Below is test function
def test_a():
s = '''
<html>
<div id='ip_list'>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
</div>
<html>
'''
from pyquery import PyQuery as pq
print()
print(pq(s)('#ip_list tr').eq(0)) # works fine
print(pq(s)('#ip_list tr').filter(':eq(0)')) #does not work
print(pq(s)('#ip_list tr').filter(':eq(0), :eq(1)')) #does not work either
I love to use pyquery to do html work, I have the same question, and it's still not working now.
Maybe the translation isn't correct https://github.com/gawel/pyquery/blob/master/pyquery/cssselectpatch.py#L367