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.
Jump to Post
>>> 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 …
All 2 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.