有没有一种方法可以返回元素的类型?

时间:2020-01-08 13:34:37

标签: dictionary lambda types

dict(map(lambda x,y:(x,type(y)) ,new_row.keys(),new_row.values()))
#this return {'customer_name': <class 'str'>, 'customer_id': <class 'str'>, 'customer_age': <class 'int'>, #'customer_city': <class 'str'>, 'phone_num': <class 'str'>}
#but I need : {'customer_name': str, 'customer_id': str, 'customer_age': int, 'customer_city':  str, 'phone_num': str}

0 个答案:

没有答案