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...@speranza.aioe.org>
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to