1

I have listed some DOM elements from a XML file and kept in list1.

list1 = [<DOM Element: DeviceInfo at 0x1915c88>, <DOM Element: ManagementServer at 0x1961b70>, <DOM Element: GatewayInfo at 0x19cd5d0>]

I have another list2, which also has DOM elements objects,

list2 = [<DOM Element: VendorConfigFile__INSTANCE__ at 0x1915f08>, <DOM Element: SupportedDataModel__INSTANCE__ at 0x191bda0>]

i want to append the list2 to list1. I use the command.

newList = list1.append(list2)

expected output:

newList = [<DOM Element: DeviceInfo at 0x1915c88>, <DOM Element: ManagementServer at 0x1961b70>, <DOM Element: GatewayInfo at 0x19cd5d0>,[<DOM Element: VendorConfigFile__INSTANCE__ at 0x1915f08>, <DOM Element: SupportedDataModel__INSTANCE__ at 0x191bda0>]]

but I'm getting it as 'None' in the newList

what exactly is the problem and how to get this done.

Thank you

in my lists it contains <'DOM Element:SupportedDataModel__INSTANCE__ at 0x191bda0'> and many such DOM element objects, contents inside <> are not displayed inside the list.

Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186
Sharath K
  • 55
  • 7

1 Answers1

1

Updated!

return type of append is None. so list1.append(list2) gives out None but also changes list1. so you should do.

newList = list(list1)
newList.append(list(list2))