Hello experts,
i found the program on youtube and try to figure out the bus towards to north longitude and latitude near to dave using xml file but it showing me an error....
lat = float(bus.findn ext('lat'))
AttributeError: 'xml.etree.Elem entTree.Element ' object as no attribute 'findnext'
Here's the code,
here is the xml file link.
Thank you in advance..
i found the program on youtube and try to figure out the bus towards to north longitude and latitude near to dave using xml file but it showing me an error....
lat = float(bus.findn ext('lat'))
AttributeError: 'xml.etree.Elem entTree.Element ' object as no attribute 'findnext'
Here's the code,
Code:
import urllib
daves_latitude = 41.98062
daves_longitude = -87.668452
from xml.etree.ElementTree import parse
doc = parse('rt22.xml')
for bus in doc.findall('bus'):
lat = float(bus.findnext('lat'))
if lat > daves_latitude:
direction = bus.findnext('d')
if direction.startwith('North'):
busid = bus.findnext('id')
print (busid,lat)
Thank you in advance..
Comment