[Tutor] Nesting lists?
Wayne Koorts
wkoorts@mweb.co.za
Thu Apr 24 14:46:02 2003
<HTML><HEAD>
</HEAD>
<BODY>
<div><FONT FACE=3D"Arial" SIZE=3D3> Hi,</FONT></div>
<div> </div>
<FONT FACE=3D"Arial" SIZE=3D3> </FONT><div><FONT FACE=3D"Arial" SIZE=3D3>=
I'd like to have 'an array of arrays'. Yes, yes I know=
it's not an array in python but a list. What I'd like to=
do is something to the effect of:</FONT></div>
<div> </div>
<FONT FACE=3D"Arial" SIZE=3D3> </FONT><div><FONT FACE=3D"Arial" SIZE=3D3>=
data =3D [data1[], data2[], data3[]]</FONT></div>
<div> </div>
<FONT FACE=3D"Arial" SIZE=3D3> </FONT><div><FONT FACE=3D"Arial" SIZE=3D3>=
but that just gives me an error. I thought of maybe using=
a dictionary?</FONT></div>
<div> </div>
<FONT FACE=3D"Arial" SIZE=3D3> </FONT><div><FONT FACE=3D"Arial" SIZE=3D3>=
The idea is that I can have a for: loop that assigns values to=
the lists within the main list in order from first to=
last. As in the e.g. data1.assign(x1),=
data2.assign(x2).</FONT></div>
<div> </div>
<FONT FACE=3D"Arial" SIZE=3D3> </FONT><div><FONT FACE=3D"Arial" SIZE=3D3>=
Regards,</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3> Wayne</FONT></div>
</body></html>