Python论坛  - 讨论区

标题:Re: [python-chinese] 怎样由list的一个成员取得该成员在list中的的序号?

2005年04月11日 星期一 09:11

Carambo qutr at tjub.com.cn
Mon Apr 11 09:11:53 HKT 2005

Tom£¬ÄãºÃ

>>> H=[3,2,7,88,32]
>>> H.index(7)
2
²»ÊÇÒ»¸öºÜÍ×ÉÆµÄ×ö·¨£¡

Carambo £¬ qutr at tjub.com.cn 
2005-4-11 
----- ÊÕµ½ÒÔÏÂÀ´ÐÅÄÚÈÝ ----- 
·¢¼þÈË: Tom 
ÊÕ¼þÈË: python-chinese 
ʱ  ¼ä: 2005-04-09, 14:39:40
Ö÷  Ìâ: [python-chinese] ÔõÑùÓÉlistµÄÒ»¸ö³ÉԱȡµÃ¸Ã³ÉÔ±ÔÚlistÖеĵÄÐòºÅ£¿


请教各位,怎样由list的一个成员取得该成员在list中的的序号?
比如,H=[3,2,7,88,32] ,怎样取得7在H中的的序号(即是2),要求不用(forï¼?
循环的方法,有没有什么运算符,直接用一个表达式或语句就可得到?
还有,同样的问题对于tuple和Dictionary又该如何解决ï¼?br> 
谢谢�br> 
_______________________________________________
python-chinese list
python-chinese at lists.python.cn
http://python.cn/mailman/listinfo/python-chinese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050411/1725b91c/attachment-0001.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年04月11日 星期一 19:29

Chun Lin Zhang zhangcl at smmail.cn
Mon Apr 11 19:29:17 HKT 2005

MailÔõ½²£¿²»Í×ÔÚʲôµØ·½£¿ÇëÖ¸½Ì
  ----- Original Message ----- 
  From: Carambo 
  To: python-chinese ; myata99 
  Sent: Monday, April 11, 2005 9:11 AM
  Subject: Re: [python-chinese] ÔõÑùÓÉlistµÄÒ»¸ö³ÉԱȡµÃ¸Ã³ÉÔ±ÔÚlistÖеĵÄÐòºÅ£¿


  Tom£¬ÄãºÃ

  >>> H=[3,2,7,88,32]
  >>> H.index(7)
  2
  ²»ÊÇÒ»¸öºÜÍ×ÉÆµÄ×ö·¨£¡

  Carambo£¬ qutr at tjub.com.cn
  2005-4-11 
    ----- ÊÕµ½ÒÔÏÂÀ´ÐÅÄÚÈÝ ----- 
    ·¢¼þÈË: Tom 
    ÊÕ¼þÈË: python-chinese 
    ʱ  ¼ä: 2005-04-09, 14:39:40
    Ö÷  Ìâ: [python-chinese] ÔõÑùÓÉlistµÄÒ»¸ö³ÉԱȡµÃ¸Ã³ÉÔ±ÔÚlistÖеĵÄÐòºÅ£¿


    请教各位,怎样由list的一个成员取得该成员在list中的的序号?
    比如,H=[3,2,7,88,32] ,怎样取得7在H中的的序号(即是2),要求不用(forï¼?
    循环的方法,有没有什么运算符,直接用一个表达式或语句就可得到?
    还有,同样的问题对于tuple和Dictionary又该如何解决ï¼?br> 
    谢谢�br> 
    _______________________________________________
    python-chinese list
    python-chinese at lists.python.cn
    http://python.cn/mailman/listinfo/python-chinese



------------------------------------------------------------------------------


  _______________________________________________
  python-chinese list
  python-chinese at lists.python.cn
  http://python.cn/mailman/listinfo/python-chinese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050411/46b4ff95/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号