Re: [Tutor] string conversion according to the terminal

2010-08-13 Thread Alan Gauld
"ANKUR AGGARWAL" wrote Hey- suppose we have a file name-"my file number" if we want to execute it into the terminal it would be like - my\ file\ number It depends what you are trying to do. so wondering is there any one in the python that change the enter string into the terminal string

Re: [Tutor] string conversion according to the terminal

2010-08-12 Thread Peter Otten
ANKUR AGGARWAL wrote: > Hey- suppose we have a file name-"my file number" > if we want to execute it into the terminal it would be like - my\ file\ > number > > so wondering is there any one in the python that change the enter string > into the terminal string one- > like if user enter the file n

Re: [Tutor] string conversion according to the terminal

2010-08-12 Thread Evert Rol
> Ok. I appreciate ur response and its gud somewhat... But we dont have only > space=" " . this '\' rules also applies to '(' ')' and all that stuff also... > so i was looking for the builtin function that fully converts it... Is there > any one?? This may depend on your system, but generally,

Re: [Tutor] string conversion according to the terminal

2010-08-12 Thread Evert Rol
> 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 If those spaces are in the actual filename, you'll wa

Re: [Tutor] string conversion according to the terminal

2010-08-12 Thread Sander Sweers
On 12 August 2010 10:40, Evert Rol 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 __

Re: [Tutor] string conversion according to the terminal

2010-08-12 Thread Evert Rol
> Hey- suppose we have a file name-"my file number" > if we want to execute it into the terminal it would be like - my\ file\ number > > so wondering is there any one in the python that change the enter string into > the terminal string one- > like if user enter the file name with path- "my file