Skip to content Skip to sidebar Skip to footer

Syntax Error From List Comprehension With A Conditional

I am using a library (pymatgen) in which a enum Orbital is defined. Each element can be defined as an OrbitalType. There are several flavors of orbital types which are defined by t

Solution 1:

The right syntax should be:

myarray = [orbital for orbital in Orbital if orbital.orbital_type == OrbitalType.d]

Post a Comment for "Syntax Error From List Comprehension With A Conditional"