Current location - Training Enrollment Network - Education and training - Python has a dictionary with a list of meta-experts, including men. How to print it out with the print function?
Python has a dictionary with a list of meta-experts, including men. How to print it out with the print function?
Sorry, I have studied this problem, and there is really no direct way.

There are two ways to solve this problem.

One is to write a dict_print function to finish parsing.

I can't find the dict_print I wrote before, so I can't send it to you. Do your best.

Another method is to use json to compare the following two printouts.

Import json

D={'a':' Hello',' b':' Shanghai'}

Dump_str = json.dumps(d, ensure _ascii=False)

Print d

Print dump _ string