On Fri, May 23, 2008 at 10:36 PM, skunkwerk <[EMAIL PROTECTED]> wrote:
> > I'm quite puzzled by this... I have a line of code that is supposed to > strip a variable of any non-alphanumeric characters (such as > whitespace): > > in my python shell, this works fine: > >>>key4cache = '!yahoo' > >>>re.sub(r"[^A-Za-z0-9]", "",key4cache) > 'yahoo' > > in django, however: > logger.debug('key4cache b4:' + key4cache) > re.sub(r"[^A-Za-z0-9]", "",str(key4cache)) > logger.debug('key4cache after:' + key4cache) > > 2008-05-23 18:22:53,325 DEBUG key4cache b4:!yahoo > 2008-05-23 18:22:53,324 DEBUG key4cache after:!yahoo > > no change. > > any ideas? > re.sub() returns the new string, but you are not saving/assigning the return value. Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---