I have a script that I run from the command line to which I would like to pass the string arguments. As in
script.py --string "thing1\nthing2"
so that the program interprets '\ n' as a new line. If string="thing1\nthing2" I want to get
print string
:
thing1 thing2
not thing1\nthing2
If I just hardcode the string "thing1 \ nthing2" in the script, it does it, but if it is entered as a command line argument via getopt, it does not recognize it. I tried a number of approaches to this: reading in the cl line as r"%s" % arg , various ways to specify it on the command line, etc., and nothing works. Ideas? Is it absolutely impossible?
python bash getopt
Astro_Dart
source share