AttributeError in re.findAll ?
Shagshag13
shagshag13 at yahoo.fr
Fri Jul 26 12:39:35 EDT 2002
hello,
from t2 :
>>> t2
'<tag0><tag1> 1 2 </tag1><tag2 attr="value">3</tag2></tag0>'
i want to get
['<tag0>', '<tag1>', 'w1', 'w2', '-', '.', '$', '&', '</tag1>', '<tag2 attr="value">', 'w3', '<tag4>', '5', '</tag4>', '</tag2>',
'</tag0>']
so i use following :
>>> t2 = """<tag0><tag1> w1 w2 - . $ & </tag1><tag2 attr="value">w3 <tag4>5</tag4></tag2></tag0>"""
>>> import re
>>> t2 = """<tag0><tag1> w1 w2 - . $ & </tag1><tag2 attr="value">w3 <tag4>5</tag4></tag2></tag0>"""
>>> p = re.compile("<[^>]*>|[^<\s]+")
>>> p.findAll(t2)
Traceback (most recent call last):
File "<pyshell#26>", line 1, in ?
p.findAll(t2)
AttributeError: findAll
>>> p = re.compile("<[^>]*>")
>>> p.findAll(t2)
Traceback (most recent call last):
File "<pyshell#28>", line 1, in ?
p.findAll(t2)
AttributeError: findAll
and get these AttributeError that i don't understand ! What does it mean ? (is it missing something ?)
thanks,
s13.
More information about the Python-list
mailing list