#coding:utf8
#author:mylittlegoblin
class Test_Getint:
def get_int(self,words):
return int(''.join(filter(str.isdigit,words)))
def test_get_int(self):
assert self.get_int("1b3b4n") == 134
assert self.get_int("11b22b44b") == 112244
样写的不严谨 修改后的如下:
#coding:utf8
#author:mylittlegoblin
class Test_Getint:
def get_int(self,words:str) -> int:
return int(''.join(filter(str.isdigit,words)))
def test_get_int(self):
assert self.get_int("1b3b4n") == 134
assert self.get_int("11b22b44b") == 112244