May-22-2024, 01:40 AM
Greetings!
I'm confused about the maxsplit.
Here is an example.
I'm trying to get 'BKM0001-01' from the string. I thought I'm splitting the string on the second (-) delimiter and it would print only the [0] element of the split, that is 'BKM0001-01' and I wanted to use the 'XLPM034NMS' the element 1 for something else.
But it prints 'BKM0001', no the 'BKM0001-01'
Thank you.
I'm confused about the maxsplit.
Here is an example.
1 2 3 4 |
s = 'BKM0001-01-XLPM034NMS' print ( f "*** {s} ***" ) dd = s.split( '-' , 2 )[ 0 ] print (dd) |
But it prints 'BKM0001', no the 'BKM0001-01'
Thank you.