python - Remove spaces in a string -
i have function:
def cesar():     n = int(raw_input("introdueix la teva clau: "))     f = raw_input("introdueix la frase xifrar: ")     ch in f:         xifrat = int(ord(ch)+int(n))         textxifrat = chr(xifrat)          print textxifrat, cesar() and want remove spaces output or string.  problem if use .replace python says can't applied str , don't know other way remove spaces.
the idea want this: m t q f % v z j % f x j become this: mtqf%vzj%fxj
why can't use .replace()?
>>> = 'm t q f % v z j % f x j' >>> a.replace(' ', '') 'mtqf%vzj%fxj' >>>  
Comments
Post a Comment