Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Python: how do I split() each symbol until reach separator symbol

I have a string:

a = "12356789:10:51:52:53"

As a result, I need a list like:

['1','2','3','5','6','7','8','9','10','51','52','53']

How can I split one by one symbols until I find : separator?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can try this:

list((x:="12356789:10:51:52:53".split(":"))[0]) + x[1:]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading