python 中的文本处理以从字符串中删除十六进制颜色代码
text processing in python to remove hex color codes from string
我有一个带有一列文本的 pandas 数据框,我想从那里删除 html 颜色代码,这里是文本示例:
{color:#000000}So today while lurking around with the processing, I have stumbled across the main reason why it takes 15 minutes. {color}{color:#000000} {color}{color:#000000}It is because our trigger tooks 15 minutes to finishing sending the signal!{color}{color:#000000} {color}{color:#000000}
我想要的输出没有那些十六进制颜色
So today while lurking around with the processing, I have stumbled across the main reason why it takes 15 minutes.It is because our trigger tooks 15 minutes to finishing sending the signal
尝试:
re.sub(r'\{color.*?\}', '', st)
st = "{color:#000000}So today while lurking around with the processing, I have stumbled across the main reason why it takes 15 minutes. {color}{color:#000000} {color}{color:#000000}It is because our trigger tooks 15 minutes to finishing sending the signal!{color}{color:#000000} {color}{color:#000000}"
re.sub(r'\{color.*?\}', '', st)
输出:
'So today while lurking around with the processing, I have stumbled across the main reason why it takes 15 minutes. It is because our trigger tooks 15 minutes to finishing sending the signal! '
我有一个带有一列文本的 pandas 数据框,我想从那里删除 html 颜色代码,这里是文本示例:
{color:#000000}So today while lurking around with the processing, I have stumbled across the main reason why it takes 15 minutes. {color}{color:#000000} {color}{color:#000000}It is because our trigger tooks 15 minutes to finishing sending the signal!{color}{color:#000000} {color}{color:#000000}
我想要的输出没有那些十六进制颜色
So today while lurking around with the processing, I have stumbled across the main reason why it takes 15 minutes.It is because our trigger tooks 15 minutes to finishing sending the signal
尝试:
re.sub(r'\{color.*?\}', '', st)
st = "{color:#000000}So today while lurking around with the processing, I have stumbled across the main reason why it takes 15 minutes. {color}{color:#000000} {color}{color:#000000}It is because our trigger tooks 15 minutes to finishing sending the signal!{color}{color:#000000} {color}{color:#000000}"
re.sub(r'\{color.*?\}', '', st)
输出:
'So today while lurking around with the processing, I have stumbled across the main reason why it takes 15 minutes. It is because our trigger tooks 15 minutes to finishing sending the signal! '