import sys # Read a file specified by the first command line argument. # Print the number of characters in the file and then the file itself. if len(sys.argv) < 2: print("Usage: infile_4.py ") sys.exit(1) # Exit with an error code filename = sys.argv[1] try: with open(filename, mode="r") as f: for i,line in enumerate(f,1): print(f"[{i}]: {line}", end='') except FileNotFoundError: print(f"The file {filename} cannot be found.") sys.exit(1) except Exception as e: print(f"An error occurred: {e}")