【发布时间】:2020-02-23 02:02:58
【问题描述】:
我尝试使用以下代码,但它不起作用
def output_without_whitespace(phrase):
phrase = phrase.replace(' ','')
new_phrase = phrase.replace("\t","")
return new_phrase
对于以下短语:“狐狸\tjumped over the log。” 输出将是:“Thefox\tjumpedoverthelog。”
如何摆脱标签?
【问题讨论】:
-
您的功能正常工作。似乎是什么问题?
标签: python-3.x string replace tabs