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: 7Q5H9438L I tried ans=answer.split(",") to remove commas but it didn't work.
kiddo39 0 Junior Poster in Training
Recommended Answers
Jump to Postanswer = ('7', 'Q', '5', 'H', '9', '4', '3', '8', 'L') ans = ''.join(answer) print ans
Should give you
7Q5H9438L
. Did this help?
Jump to Postwhat does join do? does it replace only commas or any other joining charcter?
I'll dig py docs but forum sometimes is best place for answers
All 7 Replies
jlm699 320 Veteran Poster
crono5788 0 Newbie Poster
Stefano Mtangoo 455 Senior Poster
jlm699 320 Veteran Poster
kiddo39 0 Junior Poster in Training
gmantsang 0 Newbie Poster
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
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.