【发布时间】:2015-03-12 14:44:45
【问题描述】:
我想删除大量字符串中所有出现的单撇号和双撇号。
我试过这个-
mystring = "this string shouldn't have any apostrophe - \' or \" at all"
print(mystring)
mystring.replace("'","")
mystring.replace("\"","")
print(mystring)
但它不起作用!我错过了什么吗?
【问题讨论】:
-
mystring.replace("'", "")将打印编辑后的字符串。
标签: python