Dividing a string into list according to the format given

Posted by user506710 on Stack Overflow See other posts from Stack Overflow or by user506710
Published on 2010-12-22T12:29:35Z Indexed on 2010/12/22 12:54 UTC
Read the original article Hit count: 132

Filed under:

Hello all ,

I have a string like "SAB_bARGS_D" . What I want is that the string gets divided into list of characters but whenever there is a _ sign the next character gets appended to the previous one.

So the answer to above should be ['S','A','B_b','A','R','G','S_D']

It can be done by using a for loop traversing through the list but is there an inbuilt function that I can use.....

Thanks a lot

© Stack Overflow or respective owner

Related posts about python