These two lines return a list of file names without extensions:
import os [fname.rsplit('.', 1)[0] for fname in os.listdir("C:\\X\\Data\\")]
You seem to have left the code. From what I can tell, you are trying to split the contents of a file.
To fix your problem, you need to operate with a list of files in the directory. This is what os.listdir does for you. I also added a more complex split. rsplit works on the right, and only breaks the first one found . . Note 1 as the second argument.
Tim McNamara
source share