python:programmes:multiple_loop_in_one
Ceci est une ancienne révision du document !
Boucles optimisées avec condition
[code python] [z for b in a for c in b for d in c … for z in y] Which would be like having this regular for-loop:
for b in a:
for c in b: for d in c: ... for z in y: # have z
[/code]
[code python] list(set(sorted([v for i in [dict(parser.items(x)) for x in parser.sections()] for k,v in i.items() if k.startswith('group')]))) [/code]
[code python] vec = 1,2,3], [4,5,6], [7,8,9 print [num for elem in vec for num in elem] ←—- this
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[/code]
python/programmes/multiple_loop_in_one.1393089149.txt.gz · Dernière modification : 2014/02/22 17:12 de root