Using a function for regular expression substitution
Terry Reedy
tjreedy at udel.edu
Sun Aug 29 11:35:56 EDT 2010
On 8/29/2010 10:22 AM, naugiedoggie wrote:
> Hello,
>
> I'm having a problem with using a function as the replacement in
> re.sub().
>
> Here is the function:
>
> def normalize(s) :
> return
> urllib.quote(string.capwords(urllib.unquote(s.group('provider'))))
To debug your problem, I would start with print(s) in the function and
if still not clear, unnest the expression and print intermediate results.
--
Terry Jan Reedy
More information about the Python-list
mailing list