Re: [Tutor] array of different datatypes

2008-09-23 Thread Martin Walsh
#x27;fish'], >...: [2, 'world'], >...: [1, 'hello']] > > In [2]: from operator import itemgetter > In [3]: sorted(a, key=itemgetter(1)) > > Out[3]: [[42, 'fish'], [1, 'hello'], [2, 'world']] > >>&g

Re: [Tutor] array of different datatypes

2008-09-23 Thread Reed O'Brien
#x27;], [2, 'world']] From: Steve Willoughby Sent: Monday, September 22, 2008 8:16 PM To: Dinesh B Vadhia Cc: tutor@python.org Subject: Re: [Tutor] array of different datatypes Dinesh B Vadhia wrote: I have looked (honestly!) and cannot see an array structure to allow different da

Re: [Tutor] array of different datatypes

2008-09-22 Thread Steve Willoughby
Willoughby Sent: Monday, September 22, 2008 8:16 PM To: Dinesh B Vadhia Cc: tutor@python.org Subject: Re: [Tutor] array of different datatypes Dinesh B Vadhia wrote: I have looked (honestly!) and cannot see an array structure to allow different datatypes per column. I need a 2 column array wi

Re: [Tutor] array of different datatypes

2008-09-22 Thread Dinesh B Vadhia
Thanks Steve. How do you sort on the second element of each list to get: a' = [[42, 'fish'], [1, 'hello'] [2, 'world'] ] From: Steve Willoughby Sent: Monday, September 22, 2008 8:16 PM To: Dinesh B Vadhia Cc: tutor@python.org Subj

Re: [Tutor] array of different datatypes

2008-09-22 Thread Steve Willoughby
Dinesh B Vadhia wrote: I have looked (honestly!) and cannot see an array structure to allow different datatypes per column. I need a 2 column array with column 1 = an integer and column 2 = chars, and after populating the array, sort on column 2 with column 1 sorted relatively. If by "array"

[Tutor] array of different datatypes

2008-09-22 Thread Dinesh B Vadhia
I have looked (honestly!) and cannot see an array structure to allow different datatypes per column. I need a 2 column array with column 1 = an integer and column 2 = chars, and after populating the array, sort on column 2 with column 1 sorted relatively. Thanks! Dinesh