Hi Experts,
sorry for a question,
My project requires uses specific keys to be tag name, and uses this tag name to search same tag name in a XML file.
for example:
if my XML only contains these data:
<centos>
<name>centos</name>
<version>7</version>
</centos>
and when I uses findAll("centos") method, I can get tag = name, attrib = centos ... etc
but, I need determine if my target tag didn't exist in my xml file, if I am uses findAll("centos"), if I uses findAll("fedora"), this script seems interrupt at for statement:
for system in soup.findAll('fedora'):
I understand if findAll couldn't find a target tag, then return empty string, I trying to uses:
if element == "":
print "Script couldn't find target tag in this file"
but the script seems stuck in for system in soup.findAll('xxxx').
can anyone provide a solution, thanks!