19 lines
473 B
Python
19 lines
473 B
Python
from sys import argv # include argv
|
|
|
|
script, filename = argv # define a argument
|
|
|
|
txt = open(filename) # open the file
|
|
|
|
print(f"Here's your file {filename}:") # print a script
|
|
print(txt.read()) # read and print the text from the file
|
|
|
|
txt.close()
|
|
|
|
print("Type the filename again:") # print a script
|
|
file_again = input("> ") # input from stdin
|
|
|
|
txt_again = open(file_again) # open the file
|
|
|
|
print(txt_again.read()) # read and print the text from the file
|
|
|
|
txt_again.close()
|