[Tutor] string editing

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Jul 31 10:07:07 CEST 2010


On 31/07/2010 08:50, ANKUR AGGARWAL wrote:
> hey although i knw string are mutable but i want to know if there is anyway
                                ^^^ immutable!
> to add in the string.
> like i m wrking on the tool and want to run the input from the user in the
> terminal
>
> like user makes input "this is ankur"
> and i want it like "this\ is\ ankur"  ???????
> is it possible??
>
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

 >>> ankur = "this is ankur"
 >>> ankur.replace(' ', '\ ')
'this\\ is\\ ankur'

HTH.

Mark Lawrence.



More information about the Tutor mailing list