[Tutor] need help writing subprocess output to file(s)
Matthew Herzog
matthew.herzog at gmail.com
Sun Apr 26 21:46:11 EDT 2020
Hi all.
I have to run a utility (sdptool) that checks the firmware versions on >500
servers.
What I pasted below works but the stdout needs to be written to a file, one
per IP address.
How do I capture the stdout to files? Even a single logfile would work.
Thanks.
#!/usr/bin/python3
import subprocess
with open("ips.txt") as ip_list:
ips = ip_list.readlines()
for ip in ips:
output = subprocess.Popen(["/opt/bin/sdptool", ip, "check"])
More information about the Tutor
mailing list