Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在为学校编写代码,我们需要制作一副卡片作为其中的一部分。我已经制作了甲板,但我不知道如何按我想要的方式打印它。它要么打印所有括号和逗号,要么不打印。我的目标是用逗号分隔列表的每两个值来打印它。有什么建议么?
这里的方式,也许不是最好的结果:
cards = ['3','A','7','Q','4'] print(f'"{", ".join(cards)}"')
输出:
"3, A, 7, Q, 4"