From 490b66ce94f3976b17d326f436590614203d0a05 Mon Sep 17 00:00:00 2001 From: Aaron Hands Date: Wed, 27 Nov 2019 19:25:31 +0000 Subject: [PATCH] Changed while loop to a foreach loop, shortening code --- getDepartureBoardExample.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/getDepartureBoardExample.py b/getDepartureBoardExample.py index 7b25c47..0ff1ce6 100644 --- a/getDepartureBoardExample.py +++ b/getDepartureBoardExample.py @@ -46,9 +46,6 @@ print("===============================================================================") services = res.trainServices.service - -i = 0 -while i < len(services): - t = services[i] - print(t.std + " to " + t.destination.location[0].locationName + " - " + t.etd) - i += 1 + +for service in services: + print(service.std + " to " + service.destination.location[0].locationName + " - " + service.etd)