items in an array
Sion Arrowsmith
siona at chiark.greenend.org.uk
Wed Apr 19 10:35:19 EDT 2006
shkelley at gmail.com <shkelley at gmail.com> 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/iterate through list_array to create list
>in the format I want.
I think what you want is:
list_string = ",".join(list_array)
(Don't use the name "list" as it shadows the builtin "list".)
--
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
More information about the Python-list
mailing list