Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63875
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ikorot01@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.007 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; ';-)': 0.03; 'subject:Python': 0.06; 'perl,': 0.07; 'lines:': 0.09; 'python': 0.11; "','": 0.16; "':'": 0.16; 'element,': 0.16; 'length.': 0.16; 'all,': 0.19; 'trying': 0.19; 'split': 0.19; 'separate': 0.22; 'this:': 0.26; 'second': 0.26; '(this': 0.29; 'field,': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'info.': 0.31; 'request,': 0.31; 'file': 0.32; 'text': 0.33; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'done': 0.36; 'subject:?': 0.36; 'hi,': 0.36; 'should': 0.36; 'easily': 0.37; 'thank': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'length': 0.61; 'you.': 0.62; 'address': 0.63; 'information': 0.63 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Wv+rO3b95H2kEnzya/bUQo1KS1ybfAeSqeas4KY2LVc=; b=BRLbo2xfKycHcNNHGn0eyrEiz8bH/P8D5sRPLap7b78vPNAu1xuJe5p+aPyrYs2vBO DU+hUuIOEUGRgZL2weWpbE9BiRfPGorj/7P+4FHTy7wHpg5Tv+bJVRDqfNKG++n3SWTL BUibnegoPNd3FkpgMxTjWraoiKQL2keXWiUUjT2ovp3BR+XAJiVyoT7ukVNh4dG9E/On xwJvFagPN4IttgjV5QT57PFcVpTPFo0XNj4oimVdGHSSBzCNybDIGQrz5nEg8yC0j9nT buGtPA/aTGLjvIlgpo0a79GDrJhuIarpxj5evLsIHnHAbuouLUBuUa76GwhhP8DIikar pm2Q== |
| MIME-Version | 1.0 |
| X-Received | by 10.60.52.83 with SMTP id r19mr178144oeo.1.1389689216799; Tue, 14 Jan 2014 00:46:56 -0800 (PST) |
| Date | Tue, 14 Jan 2014 00:46:56 -0800 |
| Subject | What's correct Python syntax? |
| From | Igor Korot <ikorot01@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5437.1389689219.18130.python-list@python.org> (permalink) |
| Lines | 23 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1389689219 news.xs4all.nl 2977 [2001:888:2000:d::a6]:55630 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:63875 |
Show key headers only | View raw
Hi, ALL,
I'm trying to process a file which has following lines:
192.168.1.6 > 192.168.1.7: ICMP echo request, id 100, seq 200, length 30
(this is the text file out of tcpdump)
Now I can esily split the line twice: once by ':' symbol to separate
address and the protocol information and the second time by ',' to get
information about the protocol.
However, I don't need all the protocol info. All I'm interested in is
the last field, which is length.
Is there a way to write something like this:
for data in f:
(address,traffic) = string.split(data, ':')
length = string.split(traffic, ',')[3]
I'm interesred in only one element, so why should care about everything else?
This can be easily done in Perl, but I'm stuck with Python now. ;-)
Thank you.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
What's correct Python syntax? Igor Korot <ikorot01@gmail.com> - 2014-01-14 00:46 -0800
Re: What's correct Python syntax? Rustom Mody <rustompmody@gmail.com> - 2014-01-14 00:54 -0800
Re: What's correct Python syntax? Igor Korot <ikorot01@gmail.com> - 2014-01-14 01:25 -0800
Re: What's correct Python syntax? Rustom Mody <rustompmody@gmail.com> - 2014-01-14 01:37 -0800
Re: What's correct Python syntax? Igor Korot <ikorot01@gmail.com> - 2014-01-14 02:02 -0800
Re: What's correct Python syntax? Rustom Mody <rustompmody@gmail.com> - 2014-01-14 02:16 -0800
Re: What's correct Python syntax? Igor Korot <ikorot01@gmail.com> - 2014-01-14 02:35 -0800
Re: What's correct Python syntax? Rustom Mody <rustompmody@gmail.com> - 2014-01-14 02:51 -0800
Re: What's correct Python syntax? Roy Smith <roy@panix.com> - 2014-01-14 08:47 -0500
Re: What's correct Python syntax? Peter Otten <__peter__@web.de> - 2014-01-14 12:33 +0100
Re: What's correct Python syntax? Ned Batchelder <ned@nedbatchelder.com> - 2014-01-14 07:19 -0500
Re: What's correct Python syntax? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-14 08:58 -0500
Re: What's correct Python syntax? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-14 09:37 +0000
Fwd: What's correct Python syntax? Igor Korot <ikorot01@gmail.com> - 2014-01-14 02:03 -0800
Re: Fwd: What's correct Python syntax? Larry Hudson <orgnut@yahoo.com> - 2014-01-14 22:00 -0800
Re: What's correct Python syntax? Alister <alister.ware@ntlworld.com> - 2014-01-14 10:59 +0000
Re: What's correct Python syntax? Roy Smith <roy@panix.com> - 2014-01-14 08:34 -0500
csiph-web