Beginners Question - use of variables

Sean 'Shaleh' Perry shalehperry at attbi.com
Fri Sep 6 16:58:36 EDT 2002


On Friday 06 September 2002 13:45, Martin Klaffenboeck wrote:
> Hello,
>
> Are newbies questions ok here?
>
> I've got a struktur like this:
>
> string string int timestamp
> string string int timestamp
> string string int timestamp
> ...
>
> in Perl I used to save such a thing in a multidimensional array like
>
> array(
>       array(string, string, int, timestamp),
>       array(string, string, int, timestamp),
>       array(string, string, int, timestamp))
>
> So how do I save that in python and how do I get fast to one of this
> strings or int or timestamp... ?
>
> Martin

my_list = [
           ['sean', 'perry', 25, '20020906'],
           ['Martin', 'Klaffenboeck', 20, '20020826'],
          ]

for entry in my_list:
    print entry[0], entry[2] # prints first string and the int

tutor at python.org is a list especially for those new to the language.




More information about the Python-list mailing list