I have code that when executed will give me a long list output, which is fine, but how can I get it to print without the parenthesis and commas? example: answer =('7', 'Q', '5', 'H', '9', '4', '3', '8', 'L') but I'd like it to print like this: 7 Q 5 H 9 4 3 8 L
I tried ans=answer.split(",") to remove commas but it didn't work.

Recommended Answers

All 2 Replies

>>> answer = ('7', 'Q', '5', 'H', '9', '4', '3', '8', 'L') 
>>> print(' '.join(answer))
7 Q 5 H 9 4 3 8 L
>>> help(''.join)
Help on built-in function join:

join(...) method of builtins.str instance
    S.join(iterable) -> str

    Return a string which is the concatenation of the strings in the
    iterable.  The separator between elements is S.
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.