9
>>> a = '1\n2\n3'
>>> pprint(a)
'1\n2\n3'

What i want it for pprint to print out

1
2
3

Is that possible?

lionel319
  • 1,180
  • 2
  • 17
  • 31
  • 1
    Why are you using `pprint` at all? – user2357112 Jul 12 '18 at 02:43
  • 4
    From the [very first sentence of the documentation](https://docs.python.org/3/library/pprint.html): "The pprint module provides a capability to “pretty-print” arbitrary Python data structures in a form which can be **used as input to the interpreter**." (emphasis mine) So, no, and what you want defeats the point of that module, use `print` instead. – metatoaster Jul 12 '18 at 02:43
  • The reason is because i dump all collected intormation into a dictionary. The dict looks something like this `info = { 'ls' : 'a.txt\nb.txt\nc.txt', 'pwd': '/a/b/c' }` I wanna have an easy way to to just print the entire dict is a easily readable format. – lionel319 Jul 12 '18 at 05:18
  • 2
    Call something like `info['ls'] = info['ls'].splitlines()` before calling `pprint(info)` – metatoaster Jul 12 '18 at 05:28
  • @metatoaster Ahhh That is really cool. How come i never thought of that before. Thanks a lot. That works for me :) – lionel319 Jul 12 '18 at 05:40

0 Answers0