Message355330
An simpler reproduce code:
```
import re
NUM = 99
# items = [ '(001)', '(002)', '(003)', ..., '(NUM)']
items = [r'(%03d)' % i for i in range(1, 1+NUM)]
pattern = '|'.join(items)
# repl = '\1\2\3...\NUM'
temp = ('\\' + str(i) for i in range(1, 1+NUM))
repl = ''.join(temp)
text = re.sub(pattern, repl, '(001)')
print(text)
# if NUM == 99
# output: (001)
# if NUM == 100
# output: (001@)
# if NUM == 101
# output: (001@A)
``` |
|
Date |
User |
Action |
Args |
2019-10-24 13:32:52 | malin | set | recipients:
+ malin, ezio.melotti, mrabarnett, veaba |
2019-10-24 13:32:52 | malin | set | messageid: <1571923972.79.0.67132790957.issue38582@roundup.psfhosted.org> |
2019-10-24 13:32:52 | malin | link | issue38582 messages |
2019-10-24 13:32:52 | malin | create | |
|