利用split进行分割
f=open("output.txt","r", encoding = 'utf-8',errors='ignore') for line in f: print(line.split(' ')[0])
原文件:
效果: