how to make a string like this: '20P20P20P20' into a list like this [20, 'P', 20, 'P', 20, 'P', 20]
my_string = '20P20P20P20'
list_of_steps = list(my_string)
for step in list_of_steps:
if step.isdigit():
new_map.append(int(step))
else:
new_map.append(step)
It turns into a digit, but how to join digits that are next to each other into one?