Jun-27-2020, 08:18 AM
(Jun-25-2020, 01:59 AM)MDRI Wrote: The above code is tested in windows Python 3.8.1, but Linux has Python 2Not anymore in new releases eg Ubuntu/Mint 20.. is Python 2 not included by default.
Quote:Python3 by defaultPython 3 has been in Linux distors bye default for many year,but if you do
In 20.04 LTS, the python included in the base system is Python 3.8. Python 2.7 has been moved to universe and is not included by default in any new installs.
./xmltest.py
(don't test only with this) or python xmltest.py
it will call Python 2 in most distros. Most use
python3 xmltest.py
.Look at Linux Python 3 environment and pyenv Simple Python Version Management.
And go back and look your older Thread,there is no need to use one for loop for each tag element as you do now.
# Example all the child element nodes of the country element parse = root.xpath('//country/*') >>> for tag in parse: ... if tag.text is not None: ... print(tag.text) 1 2008 141100 4 2011 59900 68 2012 13600