On 12 August 2010 10:40, Evert Rol <evert....@gmail.com> wrote: >>>> a = "my file number" >>>> a.replace(' ', '\\ ') > 'my\\ file\\ number'
What if a has more than 1 space between words? Then I think this would be a safer way. >>> print "\\ ".join("my file number".split()) my\ file\ number Greets Sander _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor