要把 CSV 檔裡的欄位抓出來, 例如:
Time [s],Value,Parity Error,Framing Error
0,0xFF,,
0.0066405,0x00,,Error
0.513227,0x40,,
0,0xFF,,
0.0066405,0x00,,Error
0.513227,0x40,,
把 Value 這個欄位印出來:
import csv
fin = open('csvfile.csv')
for row in csv.DictReader(fin):
print row['Value']
fin.close()