What does the <> operator do in python?

后端 未结 3 1544
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-02 02:13

I just came across this here, always used like this:

if string1.find(string2) <> -1:
    pass

What does the <> ope

3条回答
  •  天命终不由人
    2020-12-02 02:30

    http://docs.python.org/reference/expressions.html#notin says:

    The [operators] <> and != are equivalent; for consistency with C, != is preferred. [...] The <> spelling is considered obsolescent.

提交回复
热议问题