Strings are compared according to their order when sorted alphabetically: : Compare String « String « Python Tutorial





print "alpha" < "beta"










5.4.Compare String
5.4.1.Strings are compared according to their order when sorted alphabetically:
5.4.2.To ignore the difference between uppercase and lowercase letters, use the string methods upper or lower
5.4.3.Case Sensitive Compare
5.4.4.Case In-Sensitive Compare
5.4.5.Compare string demo
5.4.6.cmp() function performs a lexicographic (ASCII value-based) comparison for strings.