Possible Duplicate:
Passing meta-characters to Python as arguments from command line
I want to pass a parameter from the command line to a python script to specify what my input file is delimited with. (e.g. "," or "\t"). For flexibility’s sake, I’d like to specify it directly on the command line, not code in options for this parameter into the script.
e.g.
pythonscript.py --in_delimiter "\t" --in_file input.txt
I seem to be having problems with the backslash being interpreted before python receives it. I tried to escape this by adding extra backslashes but couldn’t get it to work.
My Question: Is it possible to pass something like “\t” from the command line or do I have to use codes which I interpret inside the script (e.g. c = "," or t= "\t", etc).
Thanks for your help.
Are you doing it in Bash? If so, try: