On Apr 13, 2006, at 12:09 PM, Kelvie Wong wrote: > try this: > > string = 'D c a V e r " = d w o r d : 0 0 0 0 0 6 4 0' > import re > re.sub("\s", "", string) > > On 4/13/06, david brochu jr <[EMAIL PROTECTED]> wrote: >
Even easier (if you only want to replace blank spaces, and not all whitespace): string = 'D c a V e r " = d w o r d : 0 0 0 0 0 6 4 0' string.replace(" ", "") Note to the original poster: It's a *bad* idea to call a variable 'string', as there's already a module in the standard library called 'string'. Jay P. -- http://mail.python.org/mailman/listinfo/python-list