I want to open file for reading using argparse.
In cmd it must look like: my_program.py /filepath
That's my try:
parser = argparse.ArgumentParser()
parser.add_argument('file', type = file)
args = parser.parse_args()
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…