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!

Recommended Answers

All 2 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.