[Tutor] os.path Query

John Weller john at johnweller.co.uk
Sun Feb 7 06:52:40 EST 2021


Hi

 

I need to check that a file is present in the current directory before I
attempt to open it.  I have used both os.path.isfile("some_file.txt") and
os.path.exists("some_file.txt") with apparent success which begs the
question - what is the difference between them and which should I use?

 

John

 

John Weller

07976 393631

 



More information about the Tutor mailing list