Re: items in an array

2006-04-19 Thread Sion Arrowsmith
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >I can get list to be how I want it if I use the index value as follows: > > list = ("%s" + "," + "%s", ...) % (list_array[0], list_array[1], ... > >However, the list_array will never contain a constant number of items. >So my dilema is how to loop/iter

Re: items in an array

2006-04-19 Thread Shawn Kelley
Hi All - Thanks to everyone for their input. The repsonses provided are exactly what I was looking for! Regards - Shawn -- http://mail.python.org/mailman/listinfo/python-list

Re: items in an array

2006-04-19 Thread Daniel Nogradi
> I am working on a project in which I generate an array of values > (list_array). I need to use the values in this array to create list > similar to the one below: > > list_array = [] > list = item1,item2,itemN... > > I am having difficulty in getting the values out of the original array. >

Re: items in an array

2006-04-19 Thread Renato
>>> list_array = ['aaa','bbb','ccc'] >>> for item in list_array: ... print item + ',', ... aaa, bbb, ccc, (notice the comma at the end of the print statement: this causes the suppression of the automatic newline) Is this what you need? -- Renato Ramonda -- http://mail.python.org/mailman/

Re: items in an array

2006-04-19 Thread Ant
If you just want the items concatenated with a comma separator, the following is what you need: >>> list_arr = ["one", "two", "three"] >>> list = ",".join(list_arr) >>> print(list) one,two,three -- http://mail.python.org/mailman/listinfo/python-list

Re: items in an array

2006-04-19 Thread Tim Chase
> list_array = [] > list = item1,item2,itemN... My first recommendation would be that you not use "list" as an identifier, as it's a builtin function. Odd bugs might start happening if you redefine it. > I can get list to be how I want it if I use the index value as follows: > > list =

items in an array

2006-04-19 Thread [EMAIL PROTECTED]
Hi All - I am working on a project in which I generate an array of values (list_array). I need to use the values in this array to create list similar to the one below: list_array = [] list = item1,item2,itemN... I am having difficulty in getting the values out of the original array. I have