我正在尝试匹配最后一个单词并从上一行删除。
pd.concat([DF1, DF2], axis = 1)
输入
import re
# regex to select words with _-
line = re.compile('s/^(\w+(?:[-_]\d+)?)\n(?=.*\1\b)//gm;')
here_text = '''befall_fallen-fell
closing-round
Line - Eddying, dizzying, closing-round
laughter-laugh_laugh
Line - With soft and drunken laughter-laugh_laugh
laughter-laugh_laugh
befall_fallen-fell
Line - Veiling all that may befall_fallen-fell'''
输出 - 尝试
befall_fallen-fell
closing-round
Line - Eddying, dizzying, closing-round
laughter-laugh_laugh
Line - With soft and drunken laughter-laugh_laugh
laughter-laugh_laugh
befall_fallen-fell
Line - Veiling all that may befall_fallen-fell
不确定如何开始。