📅  最后修改于: 2022-03-11 14:46:15.698000             🧑  作者: Mango
string = "abc123"
# Method 1
''.join(char for char in string if char.isdigit())
#Method 2
import re
re.sub("[^0-9]", "", string)