0

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.

2
Contributors
2
Replies
14
Views
2 Years
Discussion Span
Last Post by gmantsang
1
>>> 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.
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.