[Solved] Parsing custom string


Very simple

Use the str.split() function transform your alphabet soup, then split the single elements further by directly accessing them.

For example:

text=""'
A1 A10
A10 B14
C1 C14
C14 C8
'''

for t in text.split():
    print(
        {t[0]: t[1:]}
    )

prints:

{'A': '1'}
{'A': '10'}
{'A': '10'}
{'B': '14'}
{'C': '1'}
{'C': '14'}
{'C': '14'}
{'C': '8'}

solved Parsing custom string