I want to print out list pieces without any zeros to make it more readable.
Part of this code is in a while loop.
But I getting this error message after the loop runs once:
Traceback (most recent call last):
File "C:\Documen ts and Settings\Jos\De sktop\Towers of Henoy.py", line 68, in <module>
formatt(form)
File "C:\Documen ts and Settings\Jos\De sktop\Towers of Henoy.py", line 37, in formatt
while 0 in formatt[1] :
TypeError: 'NoneType' object is not subscriptable
Can anyone help?
-Thanks
mahem1
Part of this code is in a while loop.
Code:
import copy pieces = [ [1,2,3,4,5,6] , [0,0,0,0,0,0], [0,0,0,0,0,0] ] def formatt (formatt) : while 0 in formatt[1] : formatt[1].remove(0) while 0 in formatt[2] : formatt[2].remove(0) while 0 in formatt[0] : formatt[0].remove(0) print formatt #part in loop \/ form = copy.deepcopy(pieces) formatt(form)
Traceback (most recent call last):
File "C:\Documen ts and Settings\Jos\De sktop\Towers of Henoy.py", line 68, in <module>
formatt(form)
File "C:\Documen ts and Settings\Jos\De sktop\Towers of Henoy.py", line 37, in formatt
while 0 in formatt[1] :
TypeError: 'NoneType' object is not subscriptable
Can anyone help?
-Thanks
mahem1
Comment