【发布时间】:2021-01-31 05:54:52
【问题描述】:
如何在 Python 编程中从输入代码中删除空格(多个空格、制表符、下一行)? 例如,
input = "p y t h o n e x e r c i s e s"
或
input = "python exercises"
或
input = "python exercises\n"
我只想显示一个单词。这意味着输出将是“pythonexerecises” 如何使用 python 解决这个问题?
【问题讨论】:
-
请重新填写tour,并阅读How to Ask 和what's on-topic here。 Asking on Stack Overflow is not a substitute for doing your own research. 另外,“为我实现此功能” 是题外话。进行诚实的尝试,如果遇到困难,请提出具体的问题。