def write_routes(self):
"""Write routes to file"""
with open(os.path.join(self.out_dir, 'routes.txt'), 'wb') as fhandle:
route_fieldnames = [
'route_id', 'route_short_name', 'route_long_name', 'route_type', 'agency_id']
route_writer = csv.DictWriter(fhandle, delimiter=',',
quotechar='"', fieldnames=route_fieldnames)
route_writer.writeheader()
for rid, route in enumerate(self.routes):
route_writer.writerow({
'route_id': rid,
'route_short_name': route['route_short_name'],
'route_long_name': route['route_long_name'],
'route_type': route['route_type'],
'agency_id': route['agency_id']
})
评论列表
文章目录