Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

if else in dictionary comprehension python

{ (some_key if condition else default_key):(something_if_true if condition
          else something_if_false) for key, value in dict_.items() }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #dictionary #comprehension #python
ADD COMMENT
Topic
Name
9+4 =