Join multiple list elements into single list in python

I have following values stored in a string variable ‘id’.

map00010
map00020
map00030
map00040
map00051
map00052
map00053
map00061

I would like to extract only the numerical values and store it in a list.

I am trying following line in my code:

print(id[3:].split())

But I am getting following output:

['00010']
['00020']
['00030']
['00040']
['00051']
['00052']
['00053']
['00061']

The expected output is:

list = [00010, 00020, 00030, 00040, 00051, 00052, 00053, 00061]

Any help is highly appreciated

Answer

Try the following:

id = """map00010
map00020
map00030
map00040
map00051
map00052
map00053
map00061"""

lst = []
for item in id.split("n"):
    lst.append(item[3:])

print(lst)

I don’t know exactly how your string is formatted, but from your question, it seems as if they are separated by a "n" newline character.