from __future__ import unicode_literals
import json
data_dir = '/data/chenxiaolin/dataset_dump/'

path_venue_index = data_dir + 'venue_index_dict2.json'
path_index_venue = data_dir + 'index_venue_dict2.json'

def load_json_file(file_name):
    f_json = open(file_name, 'r')
    f_content = json.load(f_json)
    return f_content

def save_json_file(to_write, file_name):
    f_write = open(file_name, 'w')
    to_write1 = json.dumps(to_write, ensure_ascii=False)
    f_write.write(to_write1)
    f_write.close()
    # to_write1 = json.dumps(to_write, ensure_ascii=False).decode('utf8').encode('gb2312')
    # json.dump(to_write1, f_write)

index_venue_dict = {}
f_content = load_json_file(path_venue_index)
# print(f_content)
for key, value in f_content.items():
    index_venue_dict[value] = key
print(index_venue_dict)

save_json_file(index_venue_dict, path_index_venue)
