📅  最后修改于: 2022-03-11 14:45:13.739000             🧑  作者: Mango
# Python program to extract digits from string
# take string
string = "kn4ow5pro8am2"
# print original string
print("The original string:", string)
# using join() + filter() + isdigit()
num = ''.join(filter(lambda i: i.isdigit(), string))
# print extract digits
print("Extract Digits:", num)