blob: d93ba652888053738682d54b2abd1242abd16201 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import argparse
# Create an argument parser to obtain file name
parser = argparse.ArgumentParser(description='cat')
parser.add_argument('-f', '--file', help='File name')
args = parser.parse_args()
# Open the file using the `file` argument
path = args.file
with open(path, 'r') as file:
# Read and print the file contents
contents = file.read()
print(contents)
|