"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
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
> 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,
> 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
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
__
> 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