我有一个元组数组,并试图提取第一个元素,但它给出了一些随机输出。
import operator
c_details=[('id', 'integer', None, 32, 0), ('name', 'character varying', 10, None, None)]
for mapping in c_details:
source_name=map(operator.itemgetter(0), mapping)
print(source_name)
OUTPUT:
<map object at 0x01959358>
<map object at 0x01959148>
然后我试了这个。
source_name=list(map(operator.itemgetter(0), mapping))
output:
Traceback (most recent call last):
File "c:/Users/rbhuv/Desktop/code/bqshift.py", line 26, in <module>
source_name=list(map(operator.itemgetter(0), mapping))
TypeError: 'NoneType' object is not subscriptable
有人可以帮我解决这个问题吗?(它的蟒蛇3.8)
沧海一幻觉
慕桂英4014372
莫回无
一只名叫tom的猫
相关分类