使用正则表达式 很简单具体如下
str_content = "hello886"
str_pattern = re.compile(r".*[0-9]$")
if str_pattern.match(str_content):
print("是以数字结尾,内容为:%s" % str_content)
else:
print("不是以数字结尾,内容为:%s" % str_content)
使用正则表达式 很简单具体如下
str_content = "hello886"
str_pattern = re.compile(r".*[0-9]$")
if str_pattern.match(str_content):
print("是以数字结尾,内容为:%s" % str_content)
else:
print("不是以数字结尾,内容为:%s" % str_content)