scanf string in python
Erik Max Francis
max at alcyone.com
Fri Jul 18 23:14:18 EDT 2003
Bengt Richter wrote:
> Did you use the regex parens for a reason I am unaware of?
>
> >>> import re
> >>> re.findall(r'(\d+)', '(1, 2, 3)')
> ['1', '2', '3']
> >>> re.findall(r'\d+', '(1, 2, 3)')
> ['1', '2', '3']
Habit. In any other context, I'd want to isolate those buggers in a
group, so that's what I wrote that here. I wasn't specifically aware
that they were unnecessary with re.findall.
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ I'm sharing the joy / I'm glowing like sunshine
\__/ Chante Moore
More information about the Python-list
mailing list