You could use .split() to separate the name from the number, and then convert the number to an integer with int(). Something like
variable.split()
number = int(variable[1])
The variable[1] is because if you split "Anakin" and "87", 87 is the second item in the list, so it gas index [1].
`