koo*_*gee 0 python regex punctuation
我想从文件名中删除所有标点符号,但保持其文件扩展名完好无损.
我想要:
Flowers.Rose-Murree-[25.10.11].jpg
Time.Square.New-York-[20.7.09].png
Run Code Online (Sandbox Code Playgroud)
看起来像:
Flowers Rose Muree 25 10 11.jpg
Time Square New York 20 7 09.png
Run Code Online (Sandbox Code Playgroud)
我正在尝试python:
re.sub(r'[^A-Za-z0-9]', ' ', filename)
Run Code Online (Sandbox Code Playgroud)
但这会产生:
Flowers Rose Muree 25 10 11 jpg时代广场纽约20 7 09 png
如何删除标点符号但保留文件扩展名?