Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python argparse file argument

import argparse

parser = argparse.ArgumentParser()
parser.add_argument('file', type=argparse.FileType('r'))
args = parser.parse_args()

print(args.file.readlines())
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #argparse #file #argument
ADD COMMENT
Topic
Name
7+3 =