I'm having issues splitting a string. I need it to be split after the first character and then after the following four, but I'm not sure on how to do it. As an example, for the input 123456789, I would need it to be split into ['1','2345','6789']. Any help would be appreciated.
CodePudding user response:
>>> s = "123456789"
>>> s[0], s[1:5], s[5:]
('1', '2345', '6789')
Like this? Will format always be the same? Or is it anyhow conditional?