python 获取列表的键值对

 

nums = [5, 15, 35, 8, 98]  
for num_index, num_val in enumerate(nums):  
    print(num_index, num_val)

 

posted @ 2018-11-16 10:12  anobscureretreat  阅读(3154)  评论(0编辑  收藏  举报