R
R
Reikoni2021-08-03 22:01:26
Python
Reikoni, 2021-08-03 22:01:26

How to cut a string into a list?

Hello. I asked myself one question:
For example, I have a string "A729D2B91E1"
How can I parse it into a list of this kind - ["A729", "D2", "B91", "E1"]?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SKEPTIC, 2021-08-03
@ifullut

import re

a = 'A729D2B91E1'

b = re.findall(r'[A-Z]\d+', a)

print(b)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question