Quantcast
Channel: How do I check whether a file exists without exceptions? - Stack Overflow
Viewing all articles
Browse latest Browse all 47

Answer by Milad Koohi for How do I check whether a file exists without exceptions?

$
0
0

All the answers were related to different versions of PythonBut I generally write the code on the version that is minimal.


from os.path import existsfrom sys import argvscript,form_file = argvfile = open(from_file) if exists(from_file):    print "File path is invalid."  else:       print "File does not exist."


Viewing all articles
Browse latest Browse all 47

Trending Articles



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