Hi Everyone,
Here is the code that I have written for reading a file through command prompt.
Here is the code that I have written for reading a file through command prompt.
from sys import argv script, filename = argv txt = open(filename) print(f"Here's your file {filename}:") print(txt.read()) print("Type the filename again:") file_again = input("> ") txt_again = open(file_again) print(txt_again.read())but while executing this program I am facing this error
Error: txt = open(file.txt)
AttributeError: 'str' object has no attribute 'txt'
please guide me through this problem