String Operations
Learn about key string operations, including comparison, concatenation, replication, and substring searching.
Comparison operators
Strings are compatible with the comparison operators. Each character has a Unicode value. This allows strings to be compared on the basis of their Unicode values. When comparing strings, Python uses lexicographic ordering—each character is compared one by one and the string that comes first in the dictionary is said to have the smaller value. If the strings have different lengths and characters match up to the end of the shorter string, the shorter string is considered lexicographically smaller. Let’s look at a few examples:
Get hands-on with 1400+ tech skills courses.