# from sys import argv
# script, filename = argv
script = "习题15 读取文件.py"
filename = input("请输入您的文件名:")
txt = open(filename) # txt是一个可以尽情浏览filename文件内容的对象
print(f"Here's your file {filename}:") # 打印 很熟悉了
print(txt.read()) # 嘿 txt 执行您的read命令,不需要任何参数
print("Type the filename again:") #
file_again = input("> ") # 两种方式,现在剩下一种了
txt_again = open(file_again) # 注意,先打开,后读取
print(txt_again.read())
# from sys import argv
# script, filename = argv
script = "习题15 读取文件.py"
filename = input("请输入您的文件名:")
txt = open(filename) # txt是一个可以尽情浏览filename文件内容的对象
print(f"Here's your file {filename}:") # 打印 很熟悉了
print(txt.read()) # 嘿 txt 执行您的read命令,不需要任何参数
print("Type the filename again:") #
file_again = input("> ") # 两种方式,现在剩下一种了
txt_again = open(file_again) # 注意,先打开,后读取
print(txt_again.read())