Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 10 Online
OpenStudy (anonymous):

Is there a way to print without printing a newline? You see I have a list and I want to print every entry in the list to make a word.

OpenStudy (anonymous):

What language is that?

OpenStudy (microbot):

if its for Python ...i used the: ''.join(mylist) command... hope it helps.

OpenStudy (anonymous):

from __future__ import print_function print("Yo! dude", end='') print(" ... sup?")

OpenStudy (anonymous):

U could try print line, I think the trailing comma will suppress the \n

OpenStudy (microbot):

from what i understand he wants to make his list a string! ['a','b','c']---->'abc'

OpenStudy (anonymous):

Right, I guess his question isn't that clear, maybe we could see the code....?

OpenStudy (anonymous):

you can use str += to build an output string: str = "" # initialize an empty string a = "a" b = "b" str += a # append it str += b print str ab

OpenStudy (anonymous):

alist = ["a","b","c"] str = "" for thing in alist: str += thing print str abc

OpenStudy (anonymous):

snark - While you are right - you don't need all that. Look at MicroBot's answer.

OpenStudy (anonymous):

http://dpaste.com/816472/

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!