From 8aaf8d649d0b5aa2d5665fa8c63876da0d37041e Mon Sep 17 00:00:00 2001 From: MichaelSNelson Date: Tue, 5 Dec 2023 17:15:04 -0600 Subject: [PATCH] Create py_dummydoc.py --- py_dummydoc.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 py_dummydoc.py diff --git a/py_dummydoc.py b/py_dummydoc.py new file mode 100644 index 0000000..0998556 --- /dev/null +++ b/py_dummydoc.py @@ -0,0 +1,25 @@ +import os +import sys + +def find_next_filename(): + counter = 1 + filename = f"dummy{counter}.txt" + while os.path.exists(filename): + counter += 1 + filename = f"dummy{counter}.txt" + return filename + +def create_file(filename, args): + with open(filename, 'w') as file: + file.write("Arguments passed:\n") + for arg in args: + file.write(f"{arg}\n") + +# Find the next available filename +next_filename = find_next_filename() + +# Get command line arguments (excluding the script name) +arguments = sys.argv[1:] + +# Create the file and write the arguments to it +create_file(next_filename, arguments)