String Comparison Operations

The standard comparisons (<, <=, >, >=, ==, !=) apply to strings. These comparisons use the standard character-by-character comparison rules for ASCII or Unicode.

There are two additional comparisons: in and not in . These check to see if a single character string occurs in a longer string. The in operator returns a True when the character is found, False if the character is not found. The not in operator returns True if the character is not found.

>>> 
"a" in 'xyxxyabcxyzzy'

True