python 提取字符串中的数字

import re 

lg = '15001927982ttcc'

lgttcc = re.sub("\D", "", lg)

lgttcc
Out[5]: '15001927982'

int(lgttcc)
Out[6]: 15001927982
posted @ 2022-08-19 22:59  luoganttcc  阅读(34)  评论(0编辑  收藏  举报