Given a local directory structure of /foo/bar
, and assuming that a given path contains exactly one file (filename and content does not matter), what is a reasonably fast way to get the filename of that single file (NOT the file content)?
views:
131answers:
3Thanks, that does the job!
prometheus
2010-01-03 10:45:25
heh... I should have actually thought about it for a second :-p
piggles
2010-01-03 12:33:42
+1
A:
Well I know this code works...
for file in os.listdir('.'):
#do something
piggles
2010-01-03 10:32:08