您好,这是我尝试删除引号的代码,但似乎不起作用
text = "the “anatomical sex:”Local school boards shall develop and implement policies that "
print text
remove_quotation_marks = text.replace('"', '')
print remove_quotation_marks
答案 0 :(得分:1)
好像您的文本中有一些引号。智能引号与直引号的字符不同。
答案 1 :(得分:0)
text = "the “anatomical sex:”Local school boards shall develop and implement policies that "
print text
remove_quotation_marks = text.replace(text.replace('“', ''), '”', '')
print remove_quotation_marks
在我的python提示符下工作。可能还需要一个编码集。