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.
gmantsang
0
Newbie Poster
Recommended Answers
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 …
All 2 Replies
Reply to this topic
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.