On Thu, 13 Apr 2006 12:09:32 -0700, 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)
Why would you want to call in the heavy sledgehammer of regular expressions for cracking this peanut? old_s = 'D c a V e r " = d w o r d : 0 0 0 0 0 6 4 0' new_s = old_s.replace(" ", "") And if you want to remove all whitespace: new_s = "".join(old_s.split()) -- Steven. -- http://mail.python.org/mailman/listinfo/python-list