import re string1=input() parran = re.compile('\d') parrans = re.findall(parran, string1) # 此处返回的是列表 print(''.join(parrans)) # join处理成字符串