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


Groups > comp.lang.python > #63887

Re: What's correct Python syntax?

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.018
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'win32': 0.03; 'subject:Python': 0.06; 'thats': 0.09; 'python': 0.11; 'jan': 0.12; 'element,': 0.16; 'igor': 0.16; 'inclined': 0.16; 'sliced': 0.16; 'tuple,': 0.16; 'yup,': 0.16; 'elements': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'bit': 0.19; 'split': 0.19; '>>>': 0.22; 'example': 0.22; 'print': 0.22; 'creating': 0.23; 'this?': 0.23; 'sorry,': 0.24; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'easier': 0.31; "skip:' 10": 0.31; '>>>>': 0.31; 'perl': 0.31; 'probably': 0.32; 'url:python': 0.33; 'guess': 0.33; 'not.': 0.33; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; '14,': 0.36; 'right?': 0.36; 'url:listinfo': 0.36; 'doing': 0.36; 'subject:?': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'should': 0.36; 'january': 0.37; 'clear': 0.37; 'starting': 0.37; 'thank': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'you.': 0.62; 'field': 0.63; 'more': 0.64; 'skip:+ 10': 0.65; 'note:': 0.66; 'dont': 0.67; 'ending': 0.78; '2013,': 0.91; 'want!': 0.91; 'why?': 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 :content-type; bh=HIJLGalVxgWEFhnthUZicAfM37ZHDurQ7hYfBJnFCHs=; b=P/gG19TSTLk6L5wiE03gBWFgTAUML8RA3jOx6xP7Vo3anVOvIVSH2o1LU07yEpcBJX smRWFounf+QjTdEi/DB7jXweKfcGB+iEb+qIcaZHKopz72kbWWO1+P01XrGai2vyq+J5 dN20Jd9H3B+i9jONztns/jO6QqacQlgxMpoUDbyLhLZ83JyEb5FU/4C3gcCFHgTpl5Yu lsGr1KZA9HBhvtm+zyTldtv267lL3f/ADr64ygCdbf+wklZxTeN+Lcc6YOd/LLARcaq1 TiSV3tCtxZIiJ8k72ypp8K9907DuYiQd58UdeI/sjfBpn8az8Fv6DfLw5jLLIVD503kh FQDA==
MIME-Version 1.0
X-Received by 10.60.62.199 with SMTP id a7mr494464oes.64.1389695727930; Tue, 14 Jan 2014 02:35:27 -0800 (PST)
In-Reply-To <b92f81cf-0701-46cf-9d4f-2b15654b94f7@googlegroups.com>
References <mailman.5437.1389689219.18130.python-list@python.org> <cfd7f2f1-c8cb-4901-a6d7-630674ab20d4@googlegroups.com> <mailman.5439.1389691509.18130.python-list@python.org> <41a71031-be78-475f-bab2-822e35f909b7@googlegroups.com> <mailman.5443.1389693753.18130.python-list@python.org> <b92f81cf-0701-46cf-9d4f-2b15654b94f7@googlegroups.com>
Date Tue, 14 Jan 2014 02:35:27 -0800
Subject Re: 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.5449.1389695737.18130.python-list@python.org> (permalink)
Lines 55
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1389695737 news.xs4all.nl 2912 [2001:888:2000:d::a6]:56458
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:63887

Show key headers only | View raw


Hi, Rustom,

On Tue, Jan 14, 2014 at 2:16 AM, Rustom Mody <rustompmody@gmail.com> wrote:
> On Tuesday, January 14, 2014 3:32:24 PM UTC+5:30, Igor Korot wrote:
>> Hi, Rustom,
>
>> On Tue, Jan 14, 2014 at 1:37 AM, Rustom Mody  wrote:
>> > On Tuesday, January 14, 2014 2:55:00 PM UTC+5:30, Igor Korot wrote:
>> >> What if I want field 2 and field 3? ("seq 200" and "length 30")
>> > Wee you did say:
>> >> I'm interesred in only one element, so why should care about everything else?
>> > So its not clear what you want!
>
>> Sorry, I thought it would be easier to ask this way. Guess not.
>
>> I am actually looking for a way to get a result from split which is
>> sliced the way I want. Like in my example above.
>> I mean I can probably make more variable by creating a tuple, but why?
>> What is the purpose if I want only couple elements out of split.
>> Doing it Perl way does not help:
>
>> C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python
>> Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit
>> (Intel)] on win32
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> test = "I,like,my,chocolate"
>> >>> print test.split(',')[2,3]
>
> You want this?
>
>>>> test = "I,like,my,chocolate"
>>>> test.split(',')
> ['I', 'like', 'my', 'chocolate']
>>>> test.split(',')[2:4]
> ['my', 'chocolate']

Yup, thats it.
Now 2 and 4 - it's a starting point and ending point, right?

Thank you.
>
>
>> Well is there a Python way to do what I want?
>
>
> Well I for one still dont get what you want!!
>
> Heres a python one-liner using regexps
>>>> r=r'(.*) +> +(.*):.*length (\d*)'
>>>> re.findall(r,data)
> [('192.168.1.6', '192.168.1.7', '30')]
>
> Note: I am NOT suggesting you use regexps. Just that they will do what you want if you are so inclined
> --
> https://mail.python.org/mailman/listinfo/python-list

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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