How to check if a file exists (from a list of file names) or not in Python?

I have a list of file names e.g.

22.75_87.dat
22.75_87.25.dat
22.75_87.5.dat
22.75_87.75.dat
23_86.dat
23_86.25.dat
23_86.5.dat
23_86.75.dat
23_87.dat
23_87.25.dat
23_87.5.dat
23_87.75.dat
23.25_86.dat
23.25_86.25.dat
23.25_86.5.dat
23.25_86.75.dat
23.25_87.dat
23.25_87.25.dat
23.25_87.5.dat

etc.

Of these file names, there are only a few files. I need to make folders exactly the same as exisitng file names only. How to do it?

I can generate file names, but I don’t know how to move forward.

+4
source share

Source: https://habr.com/ru/post/1611162/


All Articles