May 2017
Intermediate to advanced
310 pages
8h 5m
English
Strings are immutable sequence objects, with each character representing an element in the sequence. As with all objects, we use methods to perform operations. Strings, being immutable, do not change the instance; each method simply returns a value. This value can be stored as another variable or given as an argument to a function or method.
The following table is a list of some of the most commonly used string methods and their descriptions:
|
Methods |
Descriptions |
|
s.count(substring, [start,end]) |
Counts the occurrences of a substring with optional start and end parameters. |
|
s.expandtabs([tabsize]) |
Replaces tabs with spaces. |
|
s.find(substring, [start, end]) |
Returns the index of the first occurrence of a substring ... |