这有效:
import csvresult={}with open('/tmp/test.csv','r') as f: red=csv.DictReader(f) for d in red: result.setdefault(d['team'],[]).append(d['bldg'])#results={'1': ['1450'], '3': ['204', '250', '1437'], '2': ['1440']}
欢迎分享,转载请注明来源:内存溢出
这有效:
import csvresult={}with open('/tmp/test.csv','r') as f: red=csv.DictReader(f) for d in red: result.setdefault(d['team'],[]).append(d['bldg'])#results={'1': ['1450'], '3': ['204', '250', '1437'], '2': ['1440']}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)