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


Groups > comp.lang.python > #75921

how to get the ordinal number in list

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!lightspeed.eweka.nl!lightspeed.eweka.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <elearn2014@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.097
X-Spam-Evidence '*H*': 0.81; '*S*': 0.01; 'that?': 0.05; 'subject:number': 0.09; 'ordinal': 0.16; '>>>': 0.22; 'header :User-Agent:1': 0.23; 'subject:list': 0.30; 'subject:the': 0.34; 'received:google.com': 0.35; 'received:10': 0.37; 'message- id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'simple': 0.61; 'more': 0.64; 'subject:get': 0.81
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=HvrUMneYHkTDQPFSMkBS92eLArtFeldpg0DhoTjEeh0=; b=DKm1NSBlBtxxg3+RQbdgdd/AcN2GydvAhfAqGda90/N2Xztx3ij3ej5MUW4XZZSF5y nIrRxYSOv8TNYyONWIRXv7ShEiNspQU2PN7c7A8ZWeXtH/YTNvIEIFf19w2dXTu201pq HaBdyb9kYiCYirYeEOSOIN5bQH2hUclbOod4JV+qp6GFQIe8EEzzOALo9fIzbA7BPjc3 GNnax0L8pV7m7OLhcaKYMnbVTzKetlMi4E+WeI4Up7sjpt7r479A8DD9/w+8Br+VcPQV DnBmp8N8NoSMx7Rps8Dgapk1uKfNYwswkcD9zHNSqqckWwIqDU6JNwgB7RzFREyIUnDq CVhQ==
X-Received by 10.70.124.234 with SMTP id ml10mr27731408pdb.106.1407550951487; Fri, 08 Aug 2014 19:22:31 -0700 (PDT)
Date Sat, 09 Aug 2014 10:22:21 -0700
From luofeiyu <elearn2014@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0
MIME-Version 1.0
To python-list@python.org
Subject how to get the ordinal number in list
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
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.12776.1407550960.18130.python-list@python.org> (permalink)
Lines 9
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1407550960 news.xs4all.nl 2861 [2001:888:2000:d::a6]:45622
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 2881
X-Received-Body-CRC 4270367884
Xref csiph.com comp.lang.python:75921

Show key headers only | View raw


 >>> x=["x1","x3","x7","x5"]
 >>> y="x3"

  how can i get the ordinal number by some codes?

for id ,value in enumerate(x):
     if y==value : print(id)

Is more simple way to do that?

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


Thread

how to get the ordinal number in list luofeiyu <elearn2014@gmail.com> - 2014-08-09 10:22 -0700
  Re: how to get the ordinal number in list Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-08-09 14:13 +0200
  Re: how to get the ordinal number in list Rustom Mody <rustompmody@gmail.com> - 2014-08-10 10:45 -0700
    Re: how to get the ordinal number in list Rustom Mody <rustompmody@gmail.com> - 2014-08-10 11:00 -0700
  Re: how to get the ordinal number in list ismeal shanshi <stuffstorehouse2014@gmail.com> - 2014-08-10 16:56 -0700

csiph-web