So, when I try to print help/info of Python functions function.__doc__, the console output instead of printing a newline when \n occurs in the doc string, prints \n. Can anyone help me with disabling/helping out with this?
This is my output:
'divmod(x, y) -> (div, mod)\n\nReturn the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x.'
What I would like the output to be:
'divmod(x, y) -> (div, mod)
Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x.'
P.S: I have tried this on OS X, Ubuntu with Python 2.7.
Looks like you inspected the object in the interactive shell, not printed it. If you mean print, write it.
In python 3.x print is an ordinary function, so you have to use (). The following (recommended) will work in both 2.x and 3.x: