I want to install a package (dnf install package) through python using subprocess. While installing the package the terminal will ask for a Y/N. mine is an automation script and it should directly use y without user input. how to pass the 'Y' parameter without user input.
I don't know your install code, but something like below would work.
import subprocess
subprocess.run(["dnf", "install", "packagename", "-y"])
For example, I can list files by
import subprocess
subprocess.run(["ls", "-l"])