cf.CfDict.get_keys

CfDict.get_keys(regex=None)[source]

Return a list of the key names which match a regular expression.

Parameters :
regex : str, optional

The regular expression with which to identify key names. By default all keys names are returned.

Returns :
out : list

A list of key names.

Examples

>>> d.keys()
['dim2', 'dim0', 'dim1', 'aux0', 'cm0']
>>> d.get_keys()
['dim2', 'dim0', 'dim1', 'aux0', 'cm0']
>>> d.get_keys('dim')
['dim2', 'dim0', 'dim1']
>>> d.get_keys('^aux|^dim')
['dim2', 'dim0', 'dim1', 'aux0']
>>> d.get_keys('dim[1-9]')
['dim2', 'dim1']

Previous topic

cf.CfDict.get

Next topic

cf.CfDict.has_key

This Page