jprzywoski/python-reference

String Split maximum splits function changed

Opened this issue · 0 comments

Using Python 3.10.7 with syntax of: mysplitstr = 'string'.split(',')[4]
'string' example [ '1, 2, 3, 4, 5ormore']
script execution of string'.split(',')[4] returns [ '5ormore' ]
More experimenting indicates the function of [max split] is selection of returned value.
Split uses index starting at 0 based so string example has 4 items.
When [max split] is larger than number of split items an exception occurs.