Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.python > #7636
| Path | csiph.com!news.fcku.it!bofh.it!tornado.fastwebnet.it!53ab2750!not-for-mail |
|---|---|
| Newsgroups | it.comp.lang.python |
| X-Mozilla-News-Host | news://news.fastwebnet.it:119 |
| From | Smith <smith@a-team.it> |
| Subject | Python + Ping + File csv |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-15; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Lines | 20 |
| Message-ID | <blsNy.43681$pt.43370@tornado.fastwebnet.it> (permalink) |
| Date | Thu, 7 Apr 2016 14:25:43 +0200 |
| NNTP-Posting-Host | 213.140.2.6 |
| X-Complaints-To | newsmaster@fastweb.it |
| X-Trace | tornado.fastwebnet.it 1460031943 213.140.2.6 (Thu, 07 Apr 2016 14:25:43 CEST) |
| NNTP-Posting-Date | Thu, 07 Apr 2016 14:25:43 CEST |
| Xref | csiph.com it.comp.lang.python:7636 |
Show key headers only | View raw
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