how to get the ordinal number in list
Johannes Bauer
dfnsonfsduifb at gmx.de
Sat Aug 9 08:13:13 EDT 2014
On 09.08.2014 19:22, 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))
HTH,
Johannes
--
>> Wo hattest Du das Beben nochmal GENAU vorhergesagt?
> Zumindest nicht öffentlich!
Ah, der neueste und bis heute genialste Streich unsere großen
Kosmologen: Die Geheim-Vorhersage.
- Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1 at speranza.aioe.org>
More information about the Python-list
mailing list