print ("[-] " + filename + " access denied")
exit(0)
else:
print ("[-] Usage: " + str(sys.argv[0]) + " <filename>") // Print usage if not all parameters passed/Checked
exit(0)
print ("[+] Reading from : " + filename) // Display Message and read the file contents
readfile(filename)
After Change
for filename in filenames: // Iterate for each filename passed in command line argument
if not os.path.isfile(filename): // Check the File exists
print ("[-] " + filename + " does not exist.")
filenames.remove(filename) //remove non existing files from filenames list
continue
if not os.access(filename, os.R_OK): // Check you can read the file