I'm new to python and don't know a lot about data structures, I'm trying to append extra items to an ordered dictionary via a call to a function. The goal is making an xml file with xmltodict.
OrderedDict([
('@attr1', 'aa'),
('@attr2', 'bb'),
('@attr3', 'cc'),
add_items()
])
def add_items():
items = ('item1', 'val1'),
('item2', 'val2')
return items
If items contains just item1, a single tuple?, it works. But if I add a second tuple (item2) then it doesn't. I can't get it to work with item2 included whatever I do, what data structure do items have to be in to make this work or is there a better approach?
Thanks