'NoneType' object has no attribute '__getitem__' code example
Example 1: AttributeError: 'builtin_function_or_method' object has no attribute 'randrange'
import random as rand
rows, cols = (10, 10)
arr = [[rand.randrange(10) for i in range(cols)] for j in range(rows)]
print(arr)
Example 2: AttributeError: 'Worksheet' object has no attribute 'max_raw'
ws=wb.get_sheet_by_name('Sheet1')
print(ws.max_row)
Example 3: 'NoneType' object has no attribute 'attname'
super().__init__(*args, **kwargs)
Example 4: AttributeError: 'NoneType' object has no attribute
node = child.find('EmentaMateria')
if node is not None:
ementa = node.text
else:
ementa = None