Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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

What does the <> operator do, and why not use the usual == or in?

Sorry if that has been answered before, search engines don't like punctuation.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
357 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...