Python lxml.html XPath “attribute not equal” operator not working as expected
问题 I'm trying to run the following script: #!python from urllib import urlopen #urllib.request for python3 from lxml import html url = 'http://mpk.lodz.pl/rozklady/1_11_D2D3/00d2/00d2t001.htm?r=KOZINY'+\ '%20-%20Srebrzy%F1ska,%20Cmentarna,%20Legion%F3w,%20pl.%20Wolno%B6ci'+\ ',%20Pomorska,%20Kili%F1skiego,%20Przybyszewskiego%20-%20LODOWA' raw_html = urlopen(url).read() tree = html.fromstring(raw_html) #need to .decode('windows-1250') in python3 ret = tree.xpath('//td [@class!="naglczas"]') print