User Tools

Site Tools


python:python-dictionary-comprehension

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
python:python-dictionary-comprehension [2018/06/15 19:20] – aistispython:python-dictionary-comprehension [2018/06/15 19:20] (current) – aistis
Line 23: Line 23:
 <code> <code>
 c2 = {k:{'S':c[k]} for k in c} c2 = {k:{'S':c[k]} for k in c}
 +
 +c2 = {k:{'N' if k=='id' else 'S':v} for (k,v) in c.items()} 
 +
 </code> </code>
python/python-dictionary-comprehension.1529079646.txt.gz · Last modified: by aistis