<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=Windows-1252>
<META content="MSHTML 6.00.6000.16705" name=GENERATOR></HEAD>
<BODY id=MailContainerBody
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px"
bgColor=#ffffff leftMargin=0 topMargin=0 CanvasTabStop="true"
name="Compose message area">
<DIV><FONT face=Garamond color=#000080>Thanks Steve. How do you sort on
the second element of each list to get:</FONT></DIV>
<DIV><FONT face=Garamond color=#000080></FONT> </DIV>
<DIV><FONT face=Garamond color=#000080>a' = [[42, 'fish'],</FONT></DIV>
<DIV> <FONT face=Garamond
color=#000080>[1, 'hello']</FONT></DIV>
<DIV><FONT face=Garamond
color=#000080> [2,
'world']</FONT></DIV>
<DIV> <FONT face=Garamond
color=#000080>]</FONT></DIV>
<DIV><FONT face=Garamond color=#000080></FONT> </DIV>
<DIV><FONT face=Garamond color=#000080></FONT> </DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><FONT face=Garamond color=#000080 size=3></FONT><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A
title="mailto:steve@alchemy.com CTRL + Click to follow link"
href="mailto:steve@alchemy.com">Steve Willoughby</A> </DIV>
<DIV><B>Sent:</B> Monday, September 22, 2008 8:16 PM</DIV>
<DIV><B>To:</B> <A
title="mailto:dineshbvadhia@hotmail.com CTRL + Click to follow link"
href="mailto:dineshbvadhia@hotmail.com">Dinesh B Vadhia</A> </DIV>
<DIV><B>Cc:</B> <A title=tutor@python.org
href="mailto:tutor@python.org">tutor@python.org</A> </DIV>
<DIV><B>Subject:</B> Re: [Tutor] array of different datatypes</DIV></DIV></DIV>
<DIV><BR></DIV>Dinesh B Vadhia wrote:<BR>> 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.
<BR><BR><BR>If by "array" you mean a regular Python list, the data type
of<BR>every single element may be different. So it's just how
lists<BR>always work.<BR><BR>a = [[1,
'hello'],<BR> [2,
'world'],<BR> [42,
'fish'],<BR> ]<BR><BR>> Thanks!<BR>> <BR>>
Dinesh<BR>> <BR>> <BR>> <BR>>
------------------------------------------------------------------------<BR>>
<BR>> _______________________________________________<BR>> Tutor
maillist - <A
href="mailto:Tutor@python.org">Tutor@python.org</A><BR>> <A
href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</A><BR><BR></BODY></HTML>