我正在对位置进行评级,但我不知道一块是否在某个方格上。当我运行我的代码时,我得到
AttributeError:“NoneType”对象没有属性“符号”
这是代码:
for i in range(0,8):
for j in range(0,8):
if i == 0:
s='A'
if i == 1:
s='B'
if i == 2:
s='C'
if i == 3:
s='D'
if i == 4:
s='E'
if i == 5:
s='F'
if i == 6:
s='G'
if i == 7:
s='H'
if j == 0:
e='1'
if j == 1:
e='2'
if j == 2:
e='3'
if j == 3:
e='4'
if j == 4:
e='5'
if j == 5:
e='6'
if j == 6:
e='7'
if j == 7:
e='8'
piece = board.piece_at(getattr(chess,s+e))
print(piece.symbol())