python#读csv,excel,json数据

 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"))

猜你喜欢

转载自www.cnblogs.com/hujianglang/p/9643925.html