[FIXED] AttributeError: ‘NoneType’ object has no attribute ...
blog.finxter.com › fixed-attributeerror-nonetypeTraceback (most recent call last): File "D:/PycharmProjects/Errors/attribute_error.py", line 9, in <module> print(x.group()) AttributeError: 'NoneType' object has no attribute 'group' The code encounters an attribute error because in the first iteration it cannot find a match, therefore x returns None. Hence, when we try to use the attribute for the NoneType object, it returns an attribute error. Solution: Neglect group() for the situation where x returns None and thus does not match the