一、读取CSV文件的某一列,column的数据类型是List。json
#codint=utf-8
import csv
path='/Users/cindy/Desktop/changjingci.csv' with open(path,'rb') as csvfile: reader = csv.reader(csvfile) column = [row[0] for row in reader]
二、能够查下数据的类型,在调试的过程当中须要查询某个数据类型。type(变量)spa
三、当前的str数据类型若是有空格的话,须要去空格的方法:调试
strip():把头和尾的空格去掉;lstrip():把左边的空格去掉;rstrip():把右边的空格去掉code
四、String转成Json串,而后能够直接获取字段的内容了。blog
data = json.loads(content) s=data['data']['shopList']
五、List的长度是len(strlist)ip
六、String的字段是空的判断:utf-8
s=' ' if s.strip()=='': print 's is null' 或者 if not s.strip(): print 's is null'