I want to pass in a string to my python script which contains escape sequences such as: \x00
or \t
, and spaces.
However when I pass in my string as:
some string\x00 more \tstring
python treats my string as a raw string and when I print that string from inside the script, it prints the string literally and it does not treat the \
as an escape sequence.
i.e. it prints exactly the string above.
UPDATE:(AGAIN)
I'm using python 2.7.5 to reproduce, create a script, lets call it myscript.py
:
import sys
print(sys.argv[1])
now save it and call it from the windows command prompt as such:
c:\Python27\python.exe myscript.py "abcd \x00 abcd"
the result I get is:
> 'abcd \x00 abcd'
P.S in my actual script, I am using option parser, but both have the same effect. Maybe there is a parameter I can set for option parser to handle escape sequences?