Prechádzať zdrojové kódy

ParseXML aktualisiert

Kommentare fuer ParseXML als docstring angegeben
Marcel Juschak 7 rokov pred
rodič
commit
8e833e0d63
1 zmenil súbory, kde vykonal 7 pridanie a 4 odobranie
  1. 7 4
      code/Iteration1/ParseXML.py

+ 7 - 4
code/Iteration1/ParseXML.py

@@ -1,13 +1,16 @@
 import xml.etree.ElementTree as ET
 
-# Parses an XML File at the given location
-# It is assumed, that packets are placed on the second hierarchical level and packetinformation encoded as attributes
-# Returns a List of Dictionaries, each Dictionary contains the information for one packet
 def ParseXML(path_xml):
+	"""
+	Parses an XML File
+	It is assumed, that packets are placed on the second hierarchical level and packetinformation encoded as attributes
+
+	:param path_xml: Path to the XML File
+	:return List of Dictionaries, each Dictionary contains the information for one packet
+	"""
 	tree = ET.parse(path_xml)
 	root = tree.getroot()
 
-	#Convert Tree to List of Dictionaries
 	packets = []
 	for child in root:
 		packets.append(child.attrib)