Jamie's car broke "down" in the middle of the street
如何在不手动删除引号和引号的情况下将其转换为字符串,例如:
'Jamies car broke down in the middle of the street'
任何帮助表示赞赏!谢谢,
慕仙森
浏览 148回答 3
3回答
摇曳的蔷薇
replace()一个接一个地使用:s = """Jamie's car broke "down" in the middle of the street"""print(s.replace('\'', '').replace('"', ''))# Jamies car broke down in the middle of the street
试试这个:oldstr = """Jamie's car broke "down" in the middle of the street""" #Your problem stringnewstr = oldstr.replace('\'', '').replace('"', '')) #New string using replace()print(newstr) #print result这将返回:Jamies car broke down in the middle of the street