There are many files in a folder like
sample-file.dat host-111.222.333.444.dat win.2k3.dat hello.micro.world.dat
I was using split
file = os.path.basename(path)
filename = file.split(".")[0]
but it does not work for all files, is there a better way to read whole filename even with dots and ignore only .dat extension