Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75921
| Date | 2014-08-09 10:22 -0700 |
|---|---|
| From | luofeiyu <elearn2014@gmail.com> |
| Subject | how to get the ordinal number in list |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12776.1407550960.18130.python-list@python.org> (permalink) |
>>> 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 | Next — Next in thread | Find similar | Unroll 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