python完美打印-pprint
注:完美打印,要求被打印的是字典格类型 import pprint data = { 'this is a string': "hello world!", 'this is a list': "[1, 2, 3, 4]", 'this is a tuples': "(1.0, 2.3, 4.5)" } # 普通打印 print(data) # 输出: # {'this is a string': 'hello world!', 'this is a list': '[1, 2, 3, 4]', 'this is a tuples': '(1.0, 2.3, 4.5)'} # 完美打印 pprint.pprint(data) # 输出: # {'this is a list': '[1, 2, 3, 4]', # 'this is a string': 'hello world!', # 'this is a tuples': '(1.0, 2.3, 4.5)'}