You can append the new_options
list to another list using the extend()
method or the +=
operator. Here's how you can do it:
# Your new_options list
new_options = [
{
"shortname": "-clean",
"help": "Cleans run directory",
"required": True,
"default": False,
"datatype": bool
}
]
# Another list to which you want to append new_options
existing_list = []
# Using the extend() method
existing_list.extend(new_options)
# OR using the += operator
# existing_list += new_options
print(existing_list)
Just replace existing_list
with the name of the list to which you want to append new_options
. Either the extend()
method or the +=
operator will add the elements from new_options
to the end of existing_list
.