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


Groups > comp.lang.python > #63904

Re: What's correct Python syntax?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!novso.com!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.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'win32': 0.03; 'subject:Python': 0.06; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.12; '(1,': 0.16; 'igor': 0.16; 'message-id:@4ax.com': 0.16; 'parts.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'bit': 0.19; '>>>': 0.22; 'print': 0.22; 'url:home': 0.24; 'skip:" 30': 0.26; 'skip:" 20': 0.27; 'header:X-Complaints-To:1': 0.27; '>>>>': 0.31; 'something': 0.35; 'test': 0.35; 'skip:> 10': 0.36; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'received:76': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'range': 0.61; 'more': 0.64; '2013,': 0.91; 'items,': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: What's correct Python syntax?
Date Tue, 14 Jan 2014 08:58:25 -0500
Organization IISS Elusive Unicorn
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> <CA+FnnTxQ3kq_RWzAuDsaEXxPMmTWtYR_RMT-ShtzBRLKfrJ72w@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host adsl-76-249-22-28.dsl.klmzmi.sbcglobal.net
X-Newsreader Forte Agent 6.00/32.1186
X-No-Archive YES
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.5457.1389707915.18130.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1389707915 news.xs4all.nl 2907 [2001:888:2000:d::a6]:33570
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:63904

Show key headers only | View raw


On Tue, 14 Jan 2014 02:02:24 -0800, Igor Korot <ikorot01@gmail.com>
declaimed the following:

>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]

	So close, as long as you want a contiguous range of parts.

>>> "I,like,my,chocolate".split(",")[2:3]
['my']
>>> "I,like,my,chocolate".split(",")[2:4]
['my', 'chocolate']
>>> "I,like,my,chocolate".split(",")[1:-1]
['like', 'my']
>>> 

	For arbitrary items, as long as you don't ask for something higher than
in the split..

>>> splt = "I,like,my,dark,chocolate".split(",")
>>> splt
['I', 'like', 'my', 'dark', 'chocolate']
>>> [splt[i] for i in (1, 3, 0, 2, 4)]
['like', 'dark', 'I', 'my', 'chocolate']
>>> 
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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