Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.python > #7636
| Newsgroups | it.comp.lang.python |
|---|---|
| From | Smith <smith@a-team.it> |
| Subject | Python + Ping + File csv |
| Message-ID | <blsNy.43681$pt.43370@tornado.fastwebnet.it> (permalink) |
| Date | 2016-04-07 14:25 +0200 |
Ciao a tutti,
ho questo piccolo script che ping determinati indirizzi ip.
Considerando che sono un neofita del linguaggio di programmazione
Python, mi potete aiutare a modificare queste righe al fine di mettere
l'output in un file csv ?
Grazie in anticipo
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!")
Back to it.comp.lang.python | Previous | Next — Next in thread | Find similar
Python + Ping + File csv Smith <smith@a-team.it> - 2016-04-07 14:25 +0200
Re: Python + Ping + File csv Max_Adamo <maxadamo@usenet.cnntp.org> - 2016-04-08 19:11 +0000
Re: Python + Ping + File csv Max_Adamo <maxadamo@usenet.cnntp.org> - 2016-04-09 14:19 +0000
csiph-web