Getting TypeError: 'NoneType' object is not iterable error when extending two sliced list
Getting TypeError: 'NoneType' object is not iterable error when extending two sliced list
def rotLeft(a, d):
rotate = a[:d]
Remaining = a[d:]
ar_rot=Remaining.extend(rotate)
return ar_rot
我收到 ar_rot 变量的错误。为什么我在扩展两个时收到此错误
切片列表?类型错误:'NoneType' 对象不可迭代
因为 extend() return 什么都没有。尝试
def rotLeft(a, d):
rotate = a[:d]
Remaining = a[d:]
Remaining.extend(rotate)
return Remaining
def rotLeft(a, d):
rotate = a[:d]
Remaining = a[d:]
ar_rot=Remaining.extend(rotate)
return ar_rot
我收到 ar_rot 变量的错误。为什么我在扩展两个时收到此错误 切片列表?类型错误:'NoneType' 对象不可迭代
因为 extend() return 什么都没有。尝试
def rotLeft(a, d):
rotate = a[:d]
Remaining = a[d:]
Remaining.extend(rotate)
return Remaining