一、讀取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'