List Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bill Loren

    List Question

    Hello,

    Forgive my python newbieness.
    Assume I have a list named heck_of_a_list.
    how would I extract the number of elements out of it ?
    (I'm looking for something like perl's $#heck_of_a_lis t operand)

    thanks
    B


  • Matthias Wiehl

    #2
    Re: List Question

    "Bill Loren" <lorenb2@bezeqi nt.net> writes:
    [color=blue]
    > Assume I have a list named heck_of_a_list.
    >
    > how would I extract the number of elements out of it ?[/color]

    len(heck_of_a_l ist)

    Comment

    • Gonçalo Rodrigues

      #3
      Re: List Question

      On Mon, 28 Jul 2003 00:23:46 +0200, "Bill Loren"
      <lorenb2@bezeqi nt.net> wrote:
      [color=blue]
      >Hello,
      >
      >Forgive my python newbieness.
      >Assume I have a list named heck_of_a_list.
      >how would I extract the number of elements out of it ?
      >(I'm looking for something like perl's $#heck_of_a_lis t operand)
      >
      >thanks
      >B[/color]

      Firing the interpreter:
      [color=blue][color=green][color=darkred]
      >>> heck_of_a_list = []
      >>> len(heck_of_a_l ist)[/color][/color][/color]
      0[color=blue][color=green][color=darkred]
      >>>[/color][/color][/color]


      Maybe you would like to peruse the tutorial that comes with Python.
      It's a very nice intro and it may answer some (a lot?) of your newbie
      questions.

      With my best regards,
      G. Rodrigues

      Comment

      Working...