I am trying to write a long string in Python that gets displayed as the help item of an OptParser option. In my source code .py file, I'd like to place newlines so that my code doesn't spend new lines. However, I don't want those newlines to affect how that string is displayed when the code is run. For example, I want to write:
parser.add_option("--my-option", dest="my_option", nargs=2, default=None,
help='''Here is a long description of my option. It does many things
but I want the shell to decide how to display this explanation. However,
I want newlines in this string.''')
the above way of doing things will make it so when I call my program with --help, the explanation of my-option will have many gaps in it.
How can I fix this?
thanks.