import sys # Read a file specified by the first command line argument. # Primt the number of characters in the file and then the file itself. if len(sys.argv) < 2: print("Usage: infile_3.py ") sys.exit(1) # Exit with an error code filename = sys.argv[1] # The default mode is "r" but explicitly specifying the mode as "r" provides clarity of intention. with open(filename, mode="r") as f: s = f.read() print(f"Number of characters in the file: {len(s)}\n") print(s)