[Tutor] how can I append a iteration to a tow dimensional array

Mark Tolonen metolone+gmane at gmail.com
Sat Sep 19 23:10:38 CEST 2009


"Rayon" <evosweet at hotmail.com> wrote in message 
news:BAY122DS664A5C474FBF157089866C3DF0 at phx.gbl...
> how can I append a iteration to a tow dimensional array
> so that one value can be like a key in a dir.

It's unclear what behavior you are looking for, but there are a number of 
errors in your code below.  Describe what you are trying to achieve.

> I can't use a directory because some of the values repeat and the dir 
> throws them out.
>
>
> def getMark(record):
>     for x in record.split(','):
>         return str(x).strip()

The for statement above will not iterate, but will return the first 
comma-delimited thing in record.  str(x) is redundant.  x will be a string 
already.  What do you want this function to do?

>
> array = []
> for x in  bigMethod():
>    array.append(getMark(x))
> array1=[]
> for count in array:
>      array1 = [[count],[x]]
> for v in array1:
>     print v

What do you want this to do?

-Mark





More information about the Tutor mailing list