1# Use the function int() to turn a string into an integer
2string = '123'
3integer = int(string)
4integer
5# Output:
6# 123
1import re
2s = "12 hello 52 19 some random 15 number"
3# Extract numbers and cast them to int
4list_of_nums = map(int, re.findall('\d+', s))
5print list_of_nums