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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -