On May 20, 2:27 am, Hugo Ferreira [EMAIL PROTECTED] wrote:
Both Paddy (hackish) and McGuire (right tool for the job) ideas sound
very interesting ;-) I'll definitely research on them further.
Thanks for the support...
Hackis, hackISH!
Sir, I would have you know that the idea proffered is a
On May 19, 12:32 am, Paddy [EMAIL PROTECTED] wrote:
On May 16, 6:58 pm, Hugo Ferreira [EMAIL PROTECTED] wrote:
Hi!
Is it possible to automagically coerce the named groups to python types?
e.g.:
type(re.match('(?Px\d*)', '123').groupdict()['x'])
type 'str'
But what I'm looking
Both Paddy (hackish) and McGuire (right tool for the job) ideas sound
very interesting ;-) I'll definitely research on them further.
Thanks for the support...
On 19 May 2007 04:39:58 -0700, Paul McGuire [EMAIL PROTECTED] wrote:
On May 19, 12:32 am, Paddy [EMAIL PROTECTED] wrote:
On May 16,
On May 16, 6:58 pm, Hugo Ferreira [EMAIL PROTECTED] wrote:
Hi!
Is it possible to automagically coerce the named groups to python types?
e.g.:
type(re.match('(?Px\d*)', '123').groupdict()['x'])
type 'str'
But what I'm looking forward is for the type to be 'int'.
Cheers!
Hugo
Hi!
Is it possible to automagically coerce the named groups to python types? e.g.:
type(re.match('(?Px\d*)', '123').groupdict()['x'])
type 'str'
But what I'm looking forward is for the type to be 'int'.
Cheers!
Hugo Ferreira
--
http://mail.python.org/mailman/listinfo/python-list
Hugo Ferreira wrote:
Hi!
Is it possible to automagically coerce the named groups to python types?
e.g.:
type(re.match('(?Px\d*)', '123').groupdict()['x'])
type 'str'
But what I'm looking forward is for the type to be 'int'.
Cheers!
Hugo Ferreira
So apply the int() function to
Hello Hugo,
Is it possible to automagically coerce the named groups to python types?
e.g.:
Not that I know of, however I use the following idiom:
match = my_regexp.find(some_string)
def t(name, convert=str):
return convert(match.group(name))
myint = t(field1, int)
HTH,
--
Miki [EMAIL