这样?with open('labels.txt', encoding='utf-8') as fp: obj = dict(line.rstrip('\n').split(' ', 1) for line in fp)
这样?