实例:
s="aa0100000003aeaa010000000a00803b44b4" s.split('aa')
输出结果:
['', '0100000003ae', '010000000a00803b44b4']
进一步理解num变化:
s.split("aa",0) ['aa0100000003aeaa010000000a00803b44b4'] s.split("aa",1) ['', '0100000003aeaa010000000a00803b44b4'] s.split("aa",2) ['', '0100000003ae', '010000000a00803b44b4']
由此可见:
s.split("aa") = s.split("aa",-1) = s.split("aa",2及大于len(s)-1的数)
符合要求的代码:
s="aa0100000003aeaa010000000a00803b44b4" s.split('aa')[1:] 结果: ['0100000003ae', '010000000a00803b44b4']