KML.Pair(KML.key("highlight"), KML.styleUrl("#sh_style")), id="msn_hide", ), ) ) ### Places the results of the loops into the KML document as points. for i in range(0, len(lat)): if lat[i] != "": kmlobj.Document.append( KML.Placemark( KML.Style( KML.IconStyle( KML.scale(0.5), KML.Icon(KML.href("http://crec.unl.edu/images/Icons/OA%20Mountain%201%20Red.png")), ) ), KML.name(names[i]), KML.description(alt[i] + " " + "www.summitpost.org" + URLs[i]), KML.styleUrl("#msn_hide"), KML.Point( KML.extrude(1), KML.altitudeMode("relativeToGround"), KML.coordinates("{lon},{lat},{alt}".format(lon=lon[i], lat=lat[i], alt=10)), ), ) ) ### saves the KML document as a file on the hard drive. KML = open("summitpost.kml", "w") KML.write(str(etree.tostring(etree.ElementTree(kmlobj), pretty_print=False))[2:-1]) KML.close()