使用python读取文件
from sys import argv
script,filename = argv # 使用命令参数传入需要打开的文件名
txt = open(filename)
print(f"Here' your file {filename}:")
print(txt.read())
print("Type the filename again:")
file_again = input("> ")# 采用输入的方式传入需要打开的文件名
txt_again = open(file_again)
print(txt_again.read())
在终端中使用以下命令进行文件的读取
python py文件名.py 文件名