Python提取用户输入的字符串中的数字

Python在3.5.2中求取引入了re包,具体实现代码如下

import re

content = input("请输入内容:")
content = re.sub("\D","",content)
print(content)

猜你喜欢

转载自blog.csdn.net/qq_33567641/article/details/80916700
今日推荐