Article From:https://segmentfault.com/q/1010000012152242
Question:

I would like to ask the list returned by using re.split. Why do I get more than one “at the end of the list”?

sp = re.split(r'[1-9]\d{5}', 'BIT100081TSU111114', maxsplit=2 )

[‘BIT’, ‘TSU’, ”]

Answer 0:

The rear is the space''Ah.
Because you split it with 6 numbers.
As a result'BIT'+6A number+TSU+6A number+''

Leave a Reply

Your email address will not be published. Required fields are marked *