python报错AttributeError: 'NoneType' object has no attribute 'group'和正则匹配整数和小数

1.re.search(r’\d+(.\d+)?’,s).group()里面的正则表达式匹配整数和小数,(.\d+)?判断有无小数,有则匹配,没有则只匹配整数

2.今天在写一个找出寻找文本(用C语言打印的内容输出到txt)里的变量的最大最小值的小脚本时,遇到传入si,sj两个字符以上的变量不会报错,但传入一个字符的变量就会报错,如下图:
python报错AttributeError: 'NoneType' object has no attribute 'group'和正则匹配整数和小数
python报错AttributeError: 'NoneType' object has no attribute 'group'和正则匹配整数和小数

python报错AttributeError: 'NoneType' object has no attribute 'group'和正则匹配整数和小数
改代码(在判断条件变量后增加‘=’)如下图后不报错:
python报错AttributeError: 'NoneType' object has no attribute 'group'和正则匹配整数和小数
目前还没找到原因,但应该是判断内容匹配的问题。