multidimentional tables with different types

Discussion in 'Python' started by vertigo, Dec 10, 2006.

  1. vertigo

    vertigo Guest

    Hello

    I need to create structure which holds sorted records.
    Each record should have two fields:
    Float
    String

    What type of structure will be the most appriopriate (simple) ?

    Thanx
    vertigo, Dec 10, 2006
    #1
    1. Advertising

  2. vertigo wrote:
    > Hello
    >
    > I need to create structure which holds sorted records.
    > Each record should have two fields:
    > Float
    > String
    >
    > What type of structure will be the most appriopriate (simple) ?
    >
    > Thanx


    Just use a list. e.g.:

    data = [(5.5,"foo"),(7.7,"bar")]

    for a, b in data:
    print a, b

    data.append((4.3,"egg"))
    ..
    ..
    ..
    Mathias Panzenboeck, Dec 10, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. willem
    Replies:
    2
    Views:
    521
    cristian
    Feb 15, 2005
  2. Replies:
    1
    Views:
    392
    Victor Bazarov
    Jan 24, 2005
  3. cedric
    Replies:
    2
    Views:
    316
    Michael Mair
    Dec 30, 2004
  4. Bangalore

    multidimentional array

    Bangalore, Sep 27, 2005, in forum: C++
    Replies:
    7
    Views:
    376
    Marcus Kwok
    Oct 6, 2005
  5. Sébastien Cottalorda

    IPC::Shareable Problem with multidimentional hash

    Sébastien Cottalorda, Sep 9, 2005, in forum: Perl Misc
    Replies:
    8
    Views:
    211
    Sébastien Cottalorda
    Sep 13, 2005
Loading...

Share This Page