Skip to main content
 首页 » 编程设计

python之用于在文本中查找字母和数字单词的正则表达式

2024年12月31日29lyhabc

我有这段文字:

due to previous assess c6c587469 and 4ec0f198 
nearest and with fill station in the citi 
becaus of our satisfact in the d4a29a already 
averaging my thoughts on e977f33588f react to 

我想删除所有“字母和数字”字词

在输出中,我想要

due to previous assess and  
nearest and with fill station in the citi 
becaus of our satisfact in the already 
averaging my thoughts on react to 

我试过了,但是不行。

df_colum = df_colum.str.replace('[^A-Za-z0-9\s]+', '') 

任何正则表达式专家?

谢谢

请您参考如下方法:

尝试使用这个正则表达式:

df_colum = df_colum.str.replace('\w*\d\w*', '')