# coding:utf-8
import json
def read_file(path):
    content=''
    with open(path, 'r', encoding='utf-8') as f:
        content=f.readlines()
    print('====')
    print(type(content[0]))
    dict_content=json.loads(content[0])
    return dict_content
 
def parse_data(dict_content):
    
    data_counts=dict_content.get('data').get('list')
    
    for item in data_counts:
        temp_list=[]
        depName=item.get('depStn')
        arrName=item.get('arrStn')
        temp_list.append(depName)
        temp_list.append(arrName)
        #print(temp_list)
        #print('-'.join(temp_list))
        with open('8L.txt', 'a') as f:
            f.write('-'.join(temp_list) + '\n')

if __name__=='__main__':
    dict_content=read_file(r'C:\Users\Administrator\Desktop\8L\93.json')
    parse_data(dict_content)

 

相关文章:

  • 2021-06-30
  • 2021-05-19
  • 2022-12-23
  • 2022-02-26
  • 2021-09-05
  • 2021-09-30
  • 2021-09-05
  • 2022-12-23
猜你喜欢
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
  • 2021-12-20
  • 2022-01-01
  • 2022-12-23
相关资源
相似解决方案