I'm new to scripting / programming and I have a simple script here that takes a .txt file as an input. Within that txt file is a list of encoded data. I am trying to decode them line by line using the subprocess module. However, when I run the script to decrypt, I get an error because the program is adding \n at the end of each encoded line. How can I remove \n? I attached a screenshot to show you what I see when debugging it.
#!/usr/bin/env python3
import os
import subprocess
path = "/path"
key = os.environ.get("KEY")
file = input("Filename?: ")
infile = open(file, "r")
for line in infile:
subprocess.call([path, "decrypt", "-d", line, "-k", key])