Why not match.expand('\\0')?
Magnus Lie Hetland
mlh at furu.idi.ntnu.no
Fri Dec 12 16:58:56 EST 2003
I'm using the expand method of re MatchObjects, and was surprised to
find that the references don't work with group 0...
>>> import re
>>> p = re.compile('foo')
>>> m = p.match('foo')
>>> m.group(0)
'foo'
>>> m.expand('\\0')
'\x00'
Is this intended behavior? Why should group 0 behave differently from
the others?
--
Magnus Lie Hetland "The mind is not a vessel to be filled,
http://hetland.org but a fire to be lighted." [Plutarch]
More information about the Python-list
mailing list