#input is a list named legislators, the first two elements looks like this:
#[[‘Bassett‘, ‘Richard‘, ‘1745-04-02‘, ‘M‘, ‘sen‘, ‘DE‘, ‘Anti-Administration‘], [‘Bland‘, ‘Theodorick‘, ‘1742-03-21‘, ‘‘, ‘rep‘, ‘VA‘, ‘‘]]
#Bassett Richard is the name
#1745-04-02 is bithdate
#M is gender
对生日列做处理
birth_years = [] for row in legislators: birth_list=row[2].split(‘-‘) birth_years.append(birth_list[0])
for i,row in enumerate(legislators): row.append(birth_years[i])
原文:http://www.cnblogs.com/arsh/p/5103675.html