

Dictionary befüllen:


if/else in a dictionary comprehension:
{ (some_key if condition else default_key):(something_if_true if condition
else something_if_false) for key, value in dict_.items() }
Examples are provided here (not in top-post”)