Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.082 X-Spam-Evidence: '*H*': 0.84; '*S*': 0.00; 'that?': 0.05; 'subject:number': 0.09; 'ordinal': 0.16; 'sat,': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'aug': 0.22; 'print': 0.22; 'header:User- Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'subject:list': 0.30; 'larry': 0.31; '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; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'skip:x 10': 0.40; 'how': 0.40; 'simple': 0.61; 'more': 0.64; 'charset:windows-1252': 0.65; 'subject:get': 0.81; '7:25': 0.84 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:references :in-reply-to:content-type:content-transfer-encoding; bh=dLdNwSZwArcJSpD44H/NXRcFmSD8vfKtSaUtUsbU5bQ=; b=CHcJMgn8WcxcJyp6DKLIcpB0DqJ5Mr+j6oZMDw4giTXsM5N3gbsznvv4vvYNWWfbwH IoOnAGlyyTdlTFafor22T4PFg3ncIkEYgX2qZfhsJqhYI8mLdfm3KZEEI+J2YtcfiEv3 cmF9sGs8FlKPvEvChx0D9DXKsbU64f84AYVxaARyYXsPSBzOCVbK8Q/4Sz/FG5wU0kWW zEtA5N5KxauXRwG2XIwLbgybrSAYKfmFZRGYy0+V3WE+HCff7h65ljOLfwEBHcPlAPa5 515tJ76nVCXUdHZX8dw8NvVXclSriHv2yfaaBIXgKEm+TMJGyH5Pz+iAh8/zRe32qvou tbAA== X-Received: by 10.70.29.3 with SMTP id f3mr209512pdh.142.1407551766345; Fri, 08 Aug 2014 19:36:06 -0700 (PDT) Date: Sat, 09 Aug 2014 10:35:58 -0700 From: luofeiyu 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: Re: how to get the ordinal number in list References: <53E658CD.5020904@gmail.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252; 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407551775 news.xs4all.nl 2835 [2001:888:2000:d::a6]:58291 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75925 >>> x=["x1","x3","x7","x5","x3"] >>> x.index("x3") 1 if i want the result of 1 and 4 ? On 8/8/2014 7:25 PM, Larry Martell wrote: > On Sat, Aug 9, 2014 at 1:22 PM, luofeiyu wrote: >>>>> 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? > print x.index(y)