i have a list of string with names and numbers like :
["mike5","john","sara2","bob","nick6"]
and i want to create from each string a tuple (name,age) like this :
[('mike', 5), ('john', 0), ('sara', 2), ('bob', 0), ('nick', 5)]
so if a string doesn't contain a number the age is 0
what is the simplest way to do it?
i tried to use :
temp = re.compile("([a-zA-Z]+)([0-9]+)")
res = temp.match(type).group()
but it fails