Advertisement
rfmonk

find_north.py

Jan 8th, 2014
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. # find_north.py
  4. # find all the busses traveling north
  5.  
  6. daves_latitude = 41.98062
  7. daves_longitude = -87.668452
  8.  
  9. from xml.etree.ElementTree import parse
  10. doc = parse('rt22.xml')
  11.  
  12. for bus in doc.findall('bus'):
  13.     lat = float(bus.findtext('lat'))
  14.     if lat > daves_latitude:
  15.         direction = bus.findtext('d')
  16.         if direction.startswith('North'):
  17.             busid = bus.findtext('id')
  18.             print busid, lat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement