Development

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • printing list

    0 answers - 577 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    7 May 2006 09:15:10 -0700, compboy <compboyxyz (AT) gmail (DOT) comwrote:
    How do you print elements of the list in one line?
    alist = [1, 2, 5, 10, 15]
    so it will be like this:
    1, 2, 5, 10, 15
    because if I use this code
    for i in alist:
    print i
    the result would be like this
    1
    2
    5
    10
    15
    alist = [1, 2, 5, 10, 15]
    print str(alist)[1:-1]
    1, 2, 5, 10, 15
    or not quite the same result
    alist = [1, 2, 5, 10, 15]
    for i in alist:
    print "%s," % i,
    1, 2, 5, 10, 15,
    HTH :)

Re: printing list


max 4000 letters.
Your nickname that display:
In order to stop the spam: 0 + 9 =
QUESTION ON "Development"

EMSDN.COM