On Wed, Jul 4, 2012 at 12:16 AM, levi nie <levinie...@gmail.com> wrote:
> print "aList is "+string(aList) ? > > > 2012/7/4 levi nie <levinie...@gmail.com> > >> aList is a list.i want to get the output seem this "aList is >> [x,x,x,x,x,x,x,x,x]" >> how can i get this? >> it's wrong when i write this, print "aList is "+[x,x,x,x,x,x,x,x,x] >> > > > -- > http://mail.python.org/mailman/listinfo/python-list > > Try this: print "aList is", aList That shows it like your example. The problem with how you were trying it is, you have a string and a list and you're trying to combine (concatenate) them. That doesn't work. One way to get around that is to change the list into a string, like your second post (it would be str(aList), by the way). By separating them with a comma instead of a plus, the print statement does that for you, and also inserts a space in-between them.
-- http://mail.python.org/mailman/listinfo/python-list