I have just started learning Python, and the indention is giving me lots of headache (previously I always used languages that separate blocks by braces).
I have switched many IDEs, read many tips how to avoid the indention issue, but can't understand what mistake I am having in below code that is causing "inconsistent use of tab and space ......".
Basically I am just trying to store all the text inside "mx" tags (in an xml file) in an array "fields".
import xml.etree.ElementTree as ET
tree = ET.parse('C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\wparse\data\test1.xml')
root = tree.getroot()
dicto = {}
fields = []
for device in root.iter("main_node"):
moid = device.find("subnode1").find("subnode2").find("id").text
if "valid" in moid and "ignore" not in moid:
for x in device.find("subnode1").findall("mx"):
fields.append(x.text)
print(fields)