如何强制 pprint() 每行打印一个列表/元组/字典元素?
>>> from pprint import pprint
>>> my_var = ['one', 'two', ('red','green'), {'state' : 'Oregon', 'city' : 'Portland'}]
>>> pprint(my_var)
['one', 'two', ('red', 'green'), {'city': 'Portland', 'state': 'Oregon'}]
我希望输出类似于:
['one',
'two',
('red',
'green'),
{'city': 'Portland',
'state': 'Oregon'}]