On 2014-07-10 11:05, rxjw...@gmail.com wrote:
Hi,
On a tutorial it says that '\s': Matches whitespace. Equivalent to [\t\n\r\f].
It's equivalent to [ \t\n\r\f], i.e. it also includes a space, so
either the tutorial is wrong, or you didn't look closely enough. :-)
I test it with:
re.match(r'\s*\d\d*$', ' 111')
<_sre.SRE_Match object at 0x03642BB8>
re.match(r'\t\n\r\f*\d\d*$', ' 111') # fails
The string starts with ' ', not '\t'.
re.match(r'[\t\n\r\f]*\d\d*$', ' 111') # fails
re.match(r'[\t\n\r\f]\d\d*$', ' 111') # fails
re.match(r'[\t\n\r\f]*$', ' 111') # fails
The string starts with ' ', which isn't in the character set.
What is wrong in above script? Thanks
--
https://mail.python.org/mailman/listinfo/python-list