我正在编写递归代码来反转列表。这就是我所拥有的,但是代码未能将切片分配给输入列表,从而给出了错误的'NoneType' object is not iterable。temp = a[0] a[-1] = temp return a
我已经读过切片不是对象,所以我尝试使用list()和range()来转换返回的切片,但是这样做,我仍然会得到
我已经创建了一个TensorFlow PartitionedVariable对象。不幸的是,我需要在我的程序中的其他点对它进行切片(而不是根据变量的分区方式)。不幸的是,当我尝试明显的(X[count:])时,我得到错误TypeError: PartitionedVariable object has no attribute getitem。或者有什么方法可以解决如何对PartitionedVariable进行<e