It returns the value None
(whose type is NoneType
), not the string "None"
. So if you want to compare it with a string you have to convert it.
But it's simpler to just compare it directly without converting:
if regExMagic(pattern, line) is None:
print(line)
You can also just test the truth value, since any other value it returns will be a non-falsey object. So just write:
if not regExMagic(pattern, line):
print(line)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…