python用json转csv
来源:互联网 发布:樱井知香作品封面番号 编辑:程序博客网 时间:2024/05/22 01:43
# -*- coding: utf-8 -*-
"""
Created on Wed May 31 14:07:54 2017
@author: ESRI
"""
import json
import sys
if __name__ == "__main__":
reload(sys)
sys.setdefaultencoding( "utf-8" )
f = open('C:/Users/ESRI/Desktop/jqdl10010.json','r')
fw = open('C:/Users/ESRI/Desktop/jqdl1000.csv','w')
setting = json.load(f)
features = setting['features']
for feature in features:
attr = feature['attributes']
FID = attr['FID']
OBJECTID = attr['OBJECTID']
BSM = attr['BSM']
YSDM = attr['YSDM']
TBBH = attr['TBBH']
DLMC = attr['DLMC']
XZQDM = attr['XZQDM']
DLBZ = attr['DLBZ']
TBMJ = attr['TBMJ']
TBDLMJ = attr['TBDLMJ']
Shape_Leng = attr['Shape_Leng']
Shape_Area = attr['Shape_Area']
line = str(FID)+ ',' + str(OBJECTID)+',' +str(BSM)+',' +str(YSDM)+',' +str(TBBH)+',' +str(DLMC)+',' +str(XZQDM)+',' +str(DLBZ)+',' +str(TBMJ)+',' +str(TBDLMJ)+',' +str(Shape_Leng)+',' +str(Shape_Area)
#print line
fw.write(line + '\n')
fw.close()
"""
Created on Wed May 31 14:07:54 2017
@author: ESRI
"""
import json
import sys
if __name__ == "__main__":
reload(sys)
sys.setdefaultencoding( "utf-8" )
f = open('C:/Users/ESRI/Desktop/jqdl10010.json','r')
fw = open('C:/Users/ESRI/Desktop/jqdl1000.csv','w')
setting = json.load(f)
features = setting['features']
for feature in features:
attr = feature['attributes']
FID = attr['FID']
OBJECTID = attr['OBJECTID']
BSM = attr['BSM']
YSDM = attr['YSDM']
TBBH = attr['TBBH']
DLMC = attr['DLMC']
XZQDM = attr['XZQDM']
DLBZ = attr['DLBZ']
TBMJ = attr['TBMJ']
TBDLMJ = attr['TBDLMJ']
Shape_Leng = attr['Shape_Leng']
Shape_Area = attr['Shape_Area']
line = str(FID)+ ',' + str(OBJECTID)+',' +str(BSM)+',' +str(YSDM)+',' +str(TBBH)+',' +str(DLMC)+',' +str(XZQDM)+',' +str(DLBZ)+',' +str(TBMJ)+',' +str(TBDLMJ)+',' +str(Shape_Leng)+',' +str(Shape_Area)
#print line
fw.write(line + '\n')
fw.close()
阅读全文
0 1
- python用json转csv
- python json转csv示例
- Python JSON、CSV
- csv(txt)转json
- python读写word、excel、csv、json文件
- python | 读文件 | csv 、json、pickle等
- python 如何将CSV转换为json
- json转换csv的python实现
- python实现csv转josn
- 用Python处理csv文件
- 使用python开发json、csv数据格式转换工具
- 使用python开发json、csv数据格式转换工具
- 利用python将json数据转换为csv格式
- 几个在线CSV转JSON具
- python csv
- python csv
- python-csv
- Python csv
- SELECT INTO 和 INSERT INTO SELECT 两种表复制语句
- Android学习一、MediaPlayer播放音频
- 多线程知识巩固(四)
- windows程序设计——键盘
- Masonry介绍与使用实践
- python用json转csv
- HTML巩固练习之字体样式
- “不自律”--正在让你失去真正的自由
- 第八届蓝桥杯参赛心得
- ReactNative学习问题笔记二:apk分包、运行时报“ verifyError”异常
- pip install mysqlclient报错fails with EnvironmentError: mysql_config not found
- ScreenUtil
- iOS警告收录及快速的消除方法
- 关闭浏览器session对象失效