J'ai la version Python 3.6.2 installé sur Windows 7 et je reçois l'erreur suivante:'>' pas pris en charge entre les instances de 'méthode wrapper' et 'int'
TypeError: '>' not supported between instances of 'method-wrapper' and 'int'
Comment puis-je répare ça?
# create a subclass and override the handler methods
class MyHTMLParser(HTMLParser):
# function to handle an opening tag in the doc
# this will be called when the closing ">" of the tag is reached
def handle_starttag(self, tag, attrs):
pos = self.getpos() # returns a tuple indication line and character
print ("At line: ", pos[0], " position ", pos[1])
if attrs. __len__ > 0:
print ("\tAttributes: ")
for a in attrs:
print ("\t", a[0], "=", a[1])
Cela a fonctionné. Merci beaucoup, surtout pour la méthode plus simple :) – Sparky