import cc_dat_utils import cc_json_utils import json json_reader = open("data\jcossins_ccl.json", "r") json_data = json.load(json_reader) json_reader.close() # Close the file now that we're done using it from_dat = cc_json_utils.make_cc_data_from_json(json_data) print(from_dat)
import cc_dat_utils import cc_json_utils import sys # print(str(cc_dat_utils.make_cc_data_from_dat("data/pfgd_test.dat"))) default_input_json_file = "data/uuppal_cc1.json" default_output_dat_file = "data/uuppal_cc1.dat" if len(sys.argv) == 3: input_json_file = sys.argv[1] output_dat_file = sys.argv[2] print("Using command line args:", input_json_file, output_dat_file) else: print("Unknown command line options. Using default values:", default_input_json_file, default_output_dat_file) input_json_file = default_input_json_file output_dat_file = default_output_dat_file json_data = cc_json_utils.make_cc_data_from_json(input_json_file) cc_dat_utils.write_cc_data_to_dat(json_data, output_dat_file) dat_data = cc_dat_utils.make_cc_data_from_dat(output_dat_file) print(dat_data)
import cc_dat_utils import cc_json_utils json_data = cc_json_utils.make_cc_data_from_json("data/sglickma_testData.json") cc_dat_utils.write_cc_data_to_dat(json_data, "data/sglickma_testData.dat") dat_data = cc_dat_utils.make_cc_data_from_dat("data/sglickma_testData.dat") print(dat_data)
import cc_data import cc_dat_utils import cc_json_utils import sys default_input_json_file = "data/example_data.json" default_output_dat_file = "data/example_dat.dat" #Check if both input and output file have been specified if len(sys.argv) == 3: input_json_file = sys.argv[1] output_dat_file = sys.argv[2] print("Using command line args:", input_json_file, output_dat_file) else: input_json_file = default_input_json_file output_dat_file = default_output_dat_file print("Unknown command line options. Using default values:", input_json_file, output_dat_file) #Gets json file from input or the default cc_data_file = cc_json_utils.make_cc_data_from_json(input_json_file) #Write created dat file to output file cc_dat_utils.write_cc_data_to_dat(cc_data_file, output_dat_file) print(output_dat_file+" Created")
import sys import json from cc_json_utils import make_cc_data_from_json #Import functions from other files from cc_dat_utils import write_cc_data_to_dat input_json_file = "eye_testData4.json" cc_dat = make_cc_data_from_json(input_json_file) #input name of json file write_cc_data_to_dat(cc_dat, "eye_testData4.dat") # create dat file from json file
import cc_dat_utils import cc_json_utils import cc_data output_data = cc_json_utils.make_cc_data_from_json("data/jinheel1_cc1.json") print(output_data)
text_file.close() #Part 2 input_json_file = "data/test_data.json" ### Begin Add Code Here ### #Open the file specified by input_json_file #Use the json module to load the data from the file json_data = json.load(open(input_json_file)) #Use make_game_library_from_json(json_data) to convert the data to GameLibrary data game_library = test_json_utils.make_game_library_from_json(json_data) #Print out the resulting GameLibrary data using print_game_library(game_library_data) in test_data.py print (game_library) ### End Add Code Here ### ''' #Part 3 #Load your custom JSON file input_level_json_file = "data/jiajunl2_cc1.json" output_level_dat_file = "data/jiajunl2_cc1.dat" with open(input_level_json_file, 'r') as json_file, open(output_level_dat_file, 'w') as dat_file: json_level_data = json.load(json_file) #Convert JSON data to cc_data cc_data = cc_json_utils.make_cc_data_from_json(json_level_data) #Save converted data to DAT file #print(cc_data) cc_dat_utils.write_cc_data_to_dat(cc_data, output_level_dat_file)
import cc_dat_utils, cc_json_utils, cc_data, sys if len(sys.argv) == 3: input = sys.argv[1] output = sys.argv[2] print("input:" + input + " --> output:" + output) cc_data = cc_json_utils.make_cc_data_from_json(input) cc_dat_utils.write_cc_data_to_dat(cc_data, output) print("complete") else: print("wrong number of arguments!")
import cc_dat_utils,json import cc_json_utils testData = cc_dat_utils.make_cc_data_from_dat("data/pfgd_test.dat") #print(str(testData)) #cc_dat_utils.write_cc_data_to_dat(testData, "data/pfgd_test_remake.dat") from pprint import pprint with open('data/sunghohw_cc1.json') as data_file: data = json.load(data_file) cc_data = cc_json_utils.make_cc_data_from_json("data/sunghohw_cc1.json") cc_dat_utils.write_cc_data_to_dat(cc_data,"data/sunghohw_cc1.dat")