我如何在python3中执行此操作?
The quick brown fox jumps over the lazy dog.
为...
The quick brown fox jumps over the lazy dog.
以上引用是字符串。
答案 0 :(得分:0)
您不需要在此处使用regex
。你可以通过这种方式实现你想要的目标:
a = "The quick brown fox jumps over the lazy dog."
final = " ".join(a.split())
print(final)
输出:
'The quick brown fox jumps over the lazy dog.'