码迷,mamicode.com
首页 > 编程语言 > 详细

python#读csv,excel,json数据

时间:2018-09-14 00:02:18      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:div   nbsp   load   xls   excel   int   python   word   col   

 1 #读csv,excel,json数据
 2 with open(E:\\test\\xdd.csv,r) as f:
 3     for line in f.readlines():
 4         print(line)    
 5 
 6 
 7 import pandas
 8 df = pandas.read_csv(E:\\test\\xdd.csv)
 9 print(df)
10   
11 import pandas
12 df = pandas.read_excel(E:\\test\\aa.xls)
13 print(df)
14 
15 import json
16 with open(E:\\test\\bb.json,r) as f:
17     jd = f.read()
18 dic = json.loads(jd)
19 print(dic)
20 for word in dic:
21     print(word.get("xx"),word.get("yy"))

 

python#读csv,excel,json数据

标签:div   nbsp   load   xls   excel   int   python   word   col   

原文地址:https://www.cnblogs.com/hujianglang/p/9643925.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!