Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #106667
| Path | csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Joel Goldstick <joel.goldstick@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Python,ping,csv |
| Date | Fri, 8 Apr 2016 05:18:11 -0400 |
| Lines | 29 |
| Message-ID | <mailman.75.1460107100.2253.python-list@python.org> (permalink) |
| References | <o1JNy.43731$pt.31548@tornado.fastwebnet.it> <CAPM-O+zNiCCMd1i7WD_k-Netyu6zx3muc8hcKPzkyfZRkQdcDg@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de B89JuhN/x/X7+/Dhfo17JQyahbYEEfPNPHJ7TwrTjPGQ== |
| Return-Path | <joel.goldstick@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'elif': 0.04; 'subject:Python': 0.05; 'newbie': 0.05; 'cc:addr:python- list': 0.09; 'address)': 0.09; 'csv': 0.09; 'ping': 0.09; 'res': 0.09; 'url:blog': 0.10; 'advance': 0.10; 'python': 0.10; 'language,': 0.11; 'output': 0.13; '2016': 0.16; 'file?': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subprocess': 0.16; 'wrote:': 0.16; 'all,': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'programming': 0.22; 'am,': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'print': 0.30; 'url:mailman': 0.30; 'certain': 0.31; 'url:python': 0.33; 'url:listinfo': 0.34; 'received:google.com': 0.35; 'url:org': 0.36; 'lines': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'received:209': 0.38; 'received:209.85.214': 0.39; 'url:mail': 0.40; 'your': 0.60; 'address': 0.61; 'show': 0.62; 'sample': 0.63; 'url:info': 0.71; 'smith': 0.76; 'address,': 0.77; 'subject:,': 0.82; "'3',": 0.84; 'unclear': 0.84; 'joel': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=7UFQcniEZszDYsLVCU5vzQeKYnTqEEAgB0jxFTDgYQ0=; b=JcEUIqfQDG409atvmmk97ROi1Aipo8lY2yjH+idGAw83X7KlyjfYJ01kWgtjCWfmaI pSfSzNQn5OxsN5p1Ig9Hw43DicA+mAfsJZBifQbud/ZVIYcBlPN58qXzHIgPgqTVI3q/ 03dzs/7OeQMJPauKRcS1MRwoFqQD7ZHNyWBVjxsmtPnWggZ7SOHGnq/wgZ60h7fptivt pzqjBZzIZ1q70C+k9aHF/kTv6IoY4zVNPlNiyLGcPri0XgtT2HNxtsGxeo4VqW2NdvVU e0CK08+7V9L0glm2dMClsD7mwxWd8APX4LSQqLGrpOXHBURX4SNUouuQ0+RRabIm2xTn LWSw== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=7UFQcniEZszDYsLVCU5vzQeKYnTqEEAgB0jxFTDgYQ0=; b=UCE26LfFuqc2JTgIi3LDKYkgik+1BEPsPCheeLkS84Wb9MCRpzMJGvATPC2qneUigA BHyVPuOJKS1f+G9TfYFXIfM99nOKTCVNqCwFFdh6D6TA3MWLxnD9ZQ8YXQAn5EQfX7c/ 04MR+xvqb3QryNYuDR42DOwyDwfziGeVOKugttHn2PDJApZkhahSiIJCyodWLyo9AJfz R5nzANGbS5Fz5K+bRf/CRxz9JDeW4lQ/FT4uAUwsQ0RoQ07m//bkRcsrQKw7WawcCnkV jhGDiG/hhmEfsyxrwLUp9yAlwKpue5DkemcYz4dNyGJhM7vPRt2oiFKju9TvQQe5NHUL eslA== |
| X-Gm-Message-State | AD7BkJLrGejv/HBV13xpDc4s0nd3QGC4p9NrxODt3W+UvWd9lc6Ar+SwCrvmTa3l19bYgw+Yl/qSNRZBRK7CaQ== |
| X-Received | by 10.60.150.235 with SMTP id ul11mr3721259oeb.70.1460107091608; Fri, 08 Apr 2016 02:18:11 -0700 (PDT) |
| In-Reply-To | <o1JNy.43731$pt.31548@tornado.fastwebnet.it> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <CAPM-O+zNiCCMd1i7WD_k-Netyu6zx3muc8hcKPzkyfZRkQdcDg@mail.gmail.com> |
| X-Mailman-Original-References | <o1JNy.43731$pt.31548@tornado.fastwebnet.it> |
| Xref | csiph.com comp.lang.python:106667 |
Show key headers only | View raw
On Fri, Apr 8, 2016 at 3:25 AM, Smith <smith@a-team.it> wrote:
> 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!")
> --
> https://mail.python.org/mailman/listinfo/python-list
What do you want in your csv file? Show a sample output
--
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Python,ping,csv Smith <smith@a-team.it> - 2016-04-08 09:25 +0200
Re: Python,ping,csv Joel Goldstick <joel.goldstick@gmail.com> - 2016-04-08 05:18 -0400
Re: Python,ping,csv Jason Friedman <jsf80238@gmail.com> - 2016-04-09 21:29 -0600
Re: Python,ping,csv Smith <smith@a-team.it> - 2016-04-11 10:22 +0200
Re: Python,ping,csv Smith <smith@a-team.it> - 2016-04-11 11:24 +0200
Re: Python,ping,csv Jason Friedman <jsf80238@gmail.com> - 2016-04-11 19:17 -0600
Re: Python,ping,csv Jason Friedman <jsf80238@gmail.com> - 2016-04-12 00:01 +0000
csiph-web