Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #63950 > unrolled thread

Re: What's correct Python syntax?

Started byTerry Reedy <tjreedy@udel.edu>
First post2014-01-14 17:05 -0500
Last post2014-01-14 17:05 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: What's correct Python syntax? Terry Reedy <tjreedy@udel.edu> - 2014-01-14 17:05 -0500

#63950 — Re: What's correct Python syntax?

FromTerry Reedy <tjreedy@udel.edu>
Date2014-01-14 17:05 -0500
SubjectRe: What's correct Python syntax?
Message-ID<mailman.5484.1389737139.18130.python-list@python.org>
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'

-- 
Terry Jan Reedy

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web