Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13891

How can I get a file from a directory with just a name and no file extension in python 3.12

$
0
0

I can't really find any answers online but, I am trying to find a file (mainly images) in a directory with only the name of the file (since the files are named after users ids (1.png, 2.jpg, etc...)). Is there a way of doing this? or do I require the file extension. I have a feeling this should be possible since my code is written so that it is impossible for more than one image to contain the same name with a different extension. The images are also stored in a separate directory and nothing else goes in there. I would prefer to avoid looping through the directory as that can be pretty slow.

Any help would be appreciated.


Viewing all articles
Browse latest Browse all 13891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>