For example, we can't manually enter in the list:
list = [<element1>, <element2>, <element3>...]
which throws an error:
>>> list = [<DOM Text node "u'\n\t'">]
File "<stdin>", line 1
list = [<DOM Text node "u'\n\t'">]
^
SyntaxError: invalid syntax
whereas we can put the element from the XML parse elements into a list, which doesn't cause any syntax error. I have listed some XML elements in a list:
[<DOM Text node "u'\n\t'">,
<DOM Element: APPLE at 0x18a4648>,
<DOM Text node "u'\n\t\n\t'">,
<DOM Element: GOOGLE at 0x18a4968>,
<DOM Text node "u'\n\t\n\t'">,
<DOM Element: LENOVO at 0x18a4b48>,
<DOM Text node "u'\n\t\n\t'">,
<DOM Element: SAMSUNG at 0x18a4be8>,
<DOM Text node "u '\n'">]
which works fine, but when I manually try to feed the list with above elements, it fails.
Can anyone explain why this is so?