具有蟒蛇图案的Aiml并不识别DON&T;但是认识到DO not

时间:2017-03-06 10:37:28

标签: python-2.7 aiml

这可以按预期工作

    <category>
     <pattern>DO NOT CALL ME *</pattern>
     <that>WHAT CAN I CALL YOU</that>
     <template>So what can I call you?</template>
    </category>

这会引发无法比拟的错误

    <category>
      <pattern>DON'T CALL ME *</pattern>
      <that>WHAT CAN I CALL YOU</that>
      <template>So what can I call you?</template>
    </category>

我显然做了一些愚蠢的事。谁知道什么?

1 个答案:

答案 0 :(得分:1)

您收到该错误是因为'未被转义,因此Python认为该字符串在那里结束 尝试通过添加斜杠'来转义\'