我有一个字符串
'Dogs are highly5 variable12 in1 height and weight. 123'
我想得到
'Dogs are highly variable in height and weight. 123'
我怎样才能做到这一点?
这是我现有的代码:
somestr = 'Dogs are highly5 variable12 in1 height and weight. 123'
for i, char in enumerate(somestr):
if char.isdigit():
somestr = somestr[:i] + somestr[(i+1):]
但它返回
'Dogs are highly variable1 n1 hight and weight. 123'
PIPIONE
相关分类