Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @staticmethod
- def from_file(stations):
- trains = []
- f = open("metro.txt", encoding='utf-8')
- for line in f.readlines():
- if not line: break
- data = line.split()
- n, s, d, sp, c = '', '', '', '', ''
- if len(data) == 5:
- n, s, d, sp, c = data
- elif len(data) == 6:
- n, s1, s2, d, sp, c = data
- s = s1 + s2
- s = stations[s]
- trains.append(Train(
- n, s, d, sp, c, stations
- ))
- return trains
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement