I have a folder that contains zip files. I want to be able to unzip them, and specify "A[ll]" when asked "replace file.diz".
My current code is:
import os
import subprocess
os.chdir("path-to-directory")
for i in os.listdir():
if i.endswith("zip"):
subprocess.run("unzip '*.zip'", shell=True)
At this point I am asked:
Archive: archivea.zip
replace file.diz? [y]es, [n]o, [A]ll, [N]one, [r]ename:
What Python command can I use to specify A as input when Bash returns that question? Or, if I want to specify y as input (when the Bash command gets to archiveb.zip), how do I do that each time automatically in Python? Thank you.