#1
  1. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154

    Best way to Organize Strings and Integers


    Can anyone show me a good way to organize strongs and integers without having to use lists? Many times my code doesn't seem to work correctly because it hasn't been declared in the proper spot. For instance, i get those list index's out of range and referrenced before assignment errors. Is there a way where I can just have my code read all of this like VB6 or C++ would?
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Believe it or not, the best way to organize strings and integers is to use a list. You can use a custom sort function to rearrange the values in place after adding new values to the list. If your getting IndexErrors or any other errors then this usually means you should rethink your code; rather than try to find a way around using one of Pythons main data types .

    http://www.amk.ca/python/howto/sorting/sorting.html

    I would suggest you do that.

    Mark.
    programming language development: www.netytan.com Hula

  4. #3
  5. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154
    Well, I just figured out my major problem. I was doing flags = ['True'] instead of flags = 'True' (just an example). That's why nothing was working, 8>. Thanks anyway.

IMN logo majestic logo threadwatch logo seochat tools logo