【发布时间】:2018-05-31 00:46:25
【问题描述】:
我有这个代码:
list_of_directions = ['right', 'left', 'up', 'down']
new_list = list_of_directions.remove('right')
print(len(new_list))
但我收到错误消息
TypeError: 'NoneType' 类型的对象没有 len()
我以为我了解.remove() 的工作原理,但也许我不了解?
为什么会出现这个错误?
【问题讨论】:
标签: python python-3.x list