Message230217
| Author |
peter.otten |
| Recipients |
ezio.melotti, mgdelmonte, mrabarnett, peter.otten, serhiy.storchaka |
| Date |
2014年10月29日.15:49:42 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1414597782.09.0.859698455471.issue22760@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
This is not a bug; the signature of re.sub() is
sub(pattern, repl, string, count=0, flags=0)
and the fourth argument thus the 'count' delimiting the number of substitutions that you accidentally specify as
>>> import re
>>> re.S
16
I recommend that you use a keyword arg to fix your code:
>>> re.sub('x', 'a', "x"*20, flags=re.S)
'aaaaaaaaaaaaaaaaaaaa' |
|