I have this little program(I know there is a lot of errors):
#!/usr/bin/python
import os.path
import sys
filearg = sys.argv[0]
if (filearg == ""):
filearg = input("")
else:
if (os.path.isfile(filearg)):
print "File exist"
else:
print"No file"
print filearg
print "wasn't found"
If i start it by typing python file.py testfile.txt
the output will be always(even if the file doesn't exist):
File exist
If you don't know what iam want from this program, i want to print "File 'filename' wasn't found" if the file isn't exist and if it's exist iam wan't to print "File exist"
Any ideas to solve it? Thanks
print filearg...