Python,ping,csv
Smith
smith at a-team.it
Fri Apr 8 03:25:08 EDT 2016
Hello to all,
I have this little script that pings certain ip addresses.
Considering that I am a newbie to the Python programming language, can
you help me change these lines in order to put the output into a csv file?
Sorry for unclear English
Thanks in advance
import subprocess
for ping in range(1,254):
address = "10.24.59." + str(ping)
res = subprocess.call(['ping', '-c', '3', address])
if res == 0:
print ("ping to", address, "OK")
elif res == 2:
print ("no response from", address)
else:
print ("ping to", address, "failed!")
More information about the Python-list
mailing list