Reputation: 2785
When I am in pdb and I have a large string, sometimes I'd like to print it out with newlines as actual newlines, instead of seeing them as \n in the terminal.
(Pdb) p large_string
"very large string with newline\nanother line in the large string\n\netc\n"
I'd rather see
(Pdb) printwithnewline large_string
"very large string with newline
another line in the large string
etc
"
Any tips?
Upvotes: 4
Views: 1997
Reputation: 90
You can prefix any Python command with '!', so this will also work for Python 2.x:
!print large_string
Upvotes: 0
Reputation: 10238
If you use Python 2.x you can import the print function:
from __future__ import print_function
(Pdb) print(large_string)
very large string with newline
another line in the large string
Upvotes: 2
Reputation: 386020
just call the normal print function:
(Pdb) print(large_string)
very large string with newline
another line in the large string
etc
(Pdb)
Upvotes: 6