from sys import argv script, filename = argv def read_file(): txt = open(filename, "r+", encoding="UTF-8") print(f"Here's your file {filename}: ") # print(txt.readline()) print(txt.read()) # txt.truncate() # txt.truncate() # line = txt.readline() # print(line) txt.close() def write_file(): target = open(filename, "w") print("Now I'm going to ask you for three lines.") line1 = input("Line 1: ") line2 = input("Line 2: ") line3 = input("Line 3: ") print("I'm going to write these to the file.") target.write(line1 + " ") target.write(line2 + " ") target.write(line3 + " ") print("And Finally, we close it.") target.close() if __name__ == '__main__': # test() read_file() write_file() read_file()