#!/usr/bin/env python import sys import os def wrap_quotes(input_filename): # Generate the output filename base, ext = os.path.splitext(input_filename) output_filename = f"{base}-quoted{ext}" try: with open(input_filename, 'r') as infile, open(output_filename, 'w') as outfile: for line in infile: # Strip whitespace and wrap the line in double quotes quoted_line = f'"{line.strip()}"\n' outfile.write(quoted_line) print(f"Successfully created: {output_filename}") except IOError as e: print(f"Error processing file: {e}") sys.exit(1) if __name__ == "__main__": if len(sys.argv) != 2: print("Usage: python wrap-quotes.py ") sys.exit(1) input_filename = sys.argv[1] if not os.path.exists(input_filename): print(f"Error: Input file '{input_filename}' not found.") sys.exit(1) wrap_quotes(input_filename)