Reputation: 294
import os.path
import sys
try:
os.path.isfile("random3664746474746.txtxtxtxtx")
#os.path.isfile(ros.path.join(os.getcwd(), a))
except:
print("ERROR!")
exit(3)
I'am confused. No matter what file name I give it, it always returns TRUE! Am I missing something?
Upvotes: 2
Views: 1108
Reputation: 8988
If it returns FALSE it's not an exception
import os.path
if not os.path.isfile("random3664746474746.txtxtxtxtx"):
print("ERROR!")
exit(3)
Upvotes: 3