Common python string processing and python string processing
S. find (substring, [start [end]) # searches for substrings in the specified range and returns the index value. Otherwise,-1 is returned.
For example
>>> B = 'abc'
>>> B. find ('D ')
3
>>> B. find ('D', 2, 4)
3
>>> B. find ('D', 3,4)
3
>>> B. find ('D', 2, 3)
-1
It can be seen that when a range is specified for search, the specified range is open before closing.
S. index (substring, [start [end]) # Same as find, but the ValueError is not found.
S. count (substring, [start [end]) # returns the number of substrings found.
S. split ('*') # convert string to list and separate it with *. For example:
>>> B = 'abc def ghi'
>>> B. split ('')
['Abc', 'def ', 'ghi']
'*'. Join () # convert list to string and use * to link
For example:
>>> B = 'abc def ghi'
>>> B. split ('')
['Abc', 'def ', 'ghi']
>>> C = B. split ('')
>>> '*'. Join (c)
'Abc * def * ghi'
Other usage is easy to understand and will not be described here