devwiki:python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revisionBoth sides next revision
devwiki:python [2021/12/16 19:20] – [django] yingdevwiki:python [2022/04/17 05:24] – [data operation] ying
Line 584: Line 584:
 list=[1,2,3,4,5,6] list=[1,2,3,4,5,6]
 seq=list[::-2] # [6,4,2] seq=list[::-2] # [6,4,2]
 +
 +# list to pair list
 +info = ['name','John', 'age', '17', 'address', 'abc']
 +info_pair = zip(info[::2], info[1::2])
 +# [('name', 'John'), ('age', '17'), ('address', 'abc')] 
  
 # list flatten, and remove duplicates # list flatten, and remove duplicates
  • devwiki/python.txt
  • Last modified: 2024/03/25 06:36
  • by ying