Commit 3fed2f0b63

3fed2f0b637ca18343fb0082e44532d470c1b61f

parent: 0828f6d7fb

Verified · cmc

cmc <hello@cleberg.net> · 2025-05-20 19:37 UTC

feat: add 'cat' script in Python

Layout: unified · split

.gitignore added +1
@@ -0,0 +1 @@
1python/venv\ No newline at end of file
python/cat.py added +13
@@ -0,0 +1,13 @@
1import argparse
2
3# Create an argument parser to obtain file name
4parser = argparse.ArgumentParser(description='cat')
5parser.add_argument('-f', '--file', help='File name')
6args = parser.parse_args()
7
8# Open the file using the `file` argument
9path = args.file
10with open(path, 'r') as file:
11 # Read and print the file contents
12 contents = file.read()
13 print(contents)