[CONTINUED FROM LAST REPLY...]

Likewise if your intent is to filter out any match strings
which contain non-digits, then define the start and stop
points of the pattern:

# Match only if all are digits
>>> re.match(r'\d\d*$', '111aaa222') # fails

# Match only if all are digits and,
# allow leading white-space
>>> re.match(r'\s*\d\d*$', '   111')
<_sre.SRE_Match object at 0x026D8410>
# But not trailing space!
>>> re.match(r'\s*\d\d*$', '   111 ') # fails
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to