2015-10-16 72 views

回答

0
import csv 
import operator 

idgetter = operator.itemgetter(2) 
with open('path/to/file') as infile: 
    infile.readline() 
    ids = [idgetter(row) for row in csv.reader(infile)] 
0

你可以使用熊貓。

import pandas as pd 
col = pd.read_csv('/path/to/file/')['id'] 

如果你想把它當作一個列表,只需list(col)會做的伎倆。