I want to receive a delimiter like '\t' (tab) from command line, and use it to parse a text file.
If I put
delimiter = sys.argv[1]
in the code, and type from the command line
$ python mycode.py "\t"
delimiter is '\\t' i.e., python does its thing to preserve input string as is.
I want to convert this to '\t' so that I can use e.g.,
'a\tb\tc'.split(delimiter)
to get ['a','b','c'].
I've tried to convert '\' to '\', but failed.
Is there a built-in python function to handle regex from the command line?