Import JSON from the config.cfg Import * DEF that write_data (Data, filename): file_path = the os.path.join (config_path, filename) # Print (file_path) with Open (file_path, ' W ' , encoding = ' UTF8 ' ) AS F : # If json file does not exist automatically creates json.dump (the data, f, indent = 4, ensure_ascii = False ) Print ( " write data to json file complete ... " )
= ensure_ascii False: Chinese written
above the code generation json very beautiful style files and display the correct Chinese