In most cases, you shouldn’t use a regex for that.
os.path.splitext(filename)[0]
This will also handle a filename like .bashrc correctly by keeping the whole name.
In most cases, you shouldn’t use a regex for that.
os.path.splitext(filename)[0]
This will also handle a filename like .bashrc correctly by keeping the whole name.