return dict(map(lambda (w, m): (w, float(m)), [wmsr.strip().split('\t')[0:2] for wmsr in open(f) ]))
^
SyntaxError: invalid syntax
答案 0 :(得分:0)
改为使用星图:
from itertools import starmap
with open(f) as data:
return dict(starmap(lambda w, m: (w, float(m)), (wmsr.strip().split('\t')[:2] for wmsr in data)))