0

Hello! I've run into a slight problem with my script.
As I iterate through a list of strings, I need to print each string, but they all need to print on the same line, so I used this:

for item in myList:
    print item,

The comma puts each item on the same line, but the problem is that it adds a space between the items. Is there any way around this? I cannot use:

out = ""
for item in myList:
    out += item
print out

Depending on the string, the colour in the console gets changed accordingly before printing it, therefore I cannot add them all to one output string and then that print last. Any help is appreciated!

2
Contributors
2
Replies
5
Views
8 Years
Discussion Span
Last Post by shadwickman
0

Ah! sys.stdout.write() .... I've seen it before but I had no clue what it really was. Thanks for pointing it out, Aia!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.