How to convert a list to a list of tuples?

后端 未结 7 1722
陌清茗
陌清茗 2020-11-27 02:52

I am newbie to Python and need to convert a list to dictionary. I know that we can convert a list of tuples to a dictionary.

This is the input list:



        
相关标签:
7条回答
  • 2020-11-27 03:53
    [(L[i], L[i+1]) for i in xrange(0, len(L), 2)]
    
    0 讨论(0)
提交回复
热议问题