ich habe ein for problem
ich komme einfach nicht auf die lösung
wo gehören die breaks hin und wo genau die print anweisung?
ich will ja nicht alles vier mal haben
Code: Alles auswählen
from xml.etree import ElementTree as etree
xmldoc = './xml/process.xml'
def avaPids():
root = etree.parse(xmldoc).getroot()
for longname in root.findall('.///LongName'):
for process in root.findall('.//Process'):
for pid in process.attrib.itervalues():
break
print longname.text, 'PID:', pid
if __name__ == '__main__':
avaPids()
Code: Alles auswählen
Notepad PID: 1
Notepad PID: 2
Notepad PID: 3
Notepad PID: 4
Solitaer PID: 1
Solitaer PID: 2
Solitaer PID: 3
Solitaer PID: 4
Calculator PID: 1
Calculator PID: 2
Calculator PID: 3
Calculator PID: 4
Visual Improved PID: 1
Visual Improved PID: 2
Visual Improved PID: 3
Visual Improved PID: 4
Code: Alles auswählen
Notepad PID: 1
Solitaer PID: 2
Calculator PID: 3
Visual Improved PID: 4
mor4euz