Skip to main content
Version: V2 (Ignition 8.1)

tamaki.mes.utils.stripNulls

Description

Returns a new dictionary containing only the keys of d whose values are not None. Blank strings, 0, False, and empty collections are kept: only None values are removed. The input dictionary is not modified.

Syntax

tamaki.mes.utils.stripNulls(d)

Parameters

ParameterTypeNullableDescription
dDictFalseThe input dictionary.

Returns

A new Dict with all None-valued keys removed.

Code Examples

# Drop null-valued keys before logging or submitting form data
widgetData = tamaki.mes.utils.stripNulls(dict(self.view.custom.widgetData))
# {'name': 'Widget', 'count': 0} : keys whose value was None are removed