使用:
temp = df.index df.loc[temp[i], 'Summary'] = text
试试这个:
with open('text.txt') as file: text = file.read() text = text.replace('\n', ' ') s = text.split('CATEG:') s = [x.strip() for x in s if x != ''] print(s)