Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63952
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; 'lines:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'toss': 0.09; 'igor': 0.16; 'length.': 0.16; 'over:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'trying': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'field,': 0.30; "i'm": 0.30; 'extract': 0.31; 'info.': 0.31; 'request,': 0.31; 'file': 0.32; 'subject:?': 0.36; 'hi,': 0.36; 'list': 0.37; 'needed': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'length': 0.61; 'kind': 0.63; 'received:pacbell.net': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | emile <emile@fenx.com> |
| Subject | Re: What's correct Python syntax? |
| Date | Tue, 14 Jan 2014 14:13:20 -0800 |
| References | <CA+FnnTzDdgnaNtHzBuq8bYFFOjc5RHuaEocqrzqiB7f5LKHMZg@mail.gmail.com> <lb4cap$j3a$1@ger.gmane.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | adsl-69-226-129-65.dsl.pltn13.pacbell.net |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
| In-Reply-To | <lb4cap$j3a$1@ger.gmane.org> |
| 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.5486.1389737616.18130.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1389737616 news.xs4all.nl 2926 [2001:888:2000:d::a6]:53049 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:63952 |
Show key headers only | View raw
On 01/14/2014 02:05 PM, Terry Reedy wrote:
> On 1/14/2014 3:46 AM, Igor Korot wrote:
>> 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
>
>> However, I don't need all the protocol info. All I'm interested in is
>> the last field, which is length.
>
> To directly extract only the needed info:
>
> >>> s="192.168.1.6 > 192.168.1.7: ICMP echo request, id 100, seq 200,
> length 30"
> >>> s[s.rindex(' ')+1:]
> '30'
Any particular reason to prefer that over:
>>> s.split()[-1]
'30'
Is it a length of s and speed or rindex over build and toss the list
kind of thing?
Emile
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: What's correct Python syntax? emile <emile@fenx.com> - 2014-01-14 14:13 -0800
csiph-web