Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
138 views
in Technique[技术] by (71.8m points)

python - I really do not know about file extension .data

I have code where the path is this:

tr_path = "Folds_Raw/"+fold+"/Train/*.data"

I suppose it takes all the files from the path. I putted ".csv" file, ".npy" file, ".txt" file, ".xlsx" file but it does not take any of it. Let me first put my directory screen shot:

Directory

Now when I debug the line code here tr_paths = glob.glob(tr_path, recursive=True). It shows empty [ ] list. I am confused what actually this lines of code is doing?

question from:https://stackoverflow.com/questions/66059040/i-really-do-not-know-about-file-extension-data

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It only take the files that end with the extension ".data"

You should change:

tr_path = "Folds_Raw/"+fold+"/Train/*.data"

With:

tr_path = "Folds_Raw/"+fold+"/Train/*.*"

And it will take all files.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...