Fieldset » elements

elements() → list

Retrieve the entries of this fieldset as Field elements (instead of their direct values) in sequential order. This seamlessly lets you switch from associative readout to sequential readout, allowing fieldsets to also represent document-like structures instead of just associative data.

enopreferences:
alice = icetea
bob = peppermint tea
jane = no tea at all
ann = earl grey
python>>> document = enopy.parse(input)
>>> preferences = document.fieldset('preferences')

>>> html = '<h1>Observe these fascinating tea preferences, presented in html!</h1>'

>>> for element in preferences.elements():
...  html += f"<strong>{element.name}</strong> likes {element.value}.<br>"

>>> with open('index.html', 'w') as file:
...   file.write(html)

Return value

A list containing the elements of this fieldset.