import sys infile = sys.argv[1] outfile = f"{infile}.out" with open(infile, "r") as f_in, open(outfile, "w") as f_out: for line in f_in: f_out.write(f' \"{line.strip()}\\n\" \\\n')