parse_location_name¶
-
pyrcs.utils.
parse_location_name
(location_name)[source]¶ Parse location name (and its associated note).
- Parameters
location_name (str or None) – location name (in raw data)
- Returns
location name and, if any, note
- Return type
tuple
Examples:
>>> from pyrcs.utils import parse_location_name >>> location_dat = 'Abbey Wood' >>> dat_and_note = parse_location_name(location_dat) >>> print(dat_and_note) ('Abbey Wood', '') >>> location_dat = None >>> dat_and_note = parse_location_name(location_dat) >>> print(dat_and_note) ('', '') >>> location_dat = 'Abercynon (formerly Abercynon South)' >>> dat_and_note = parse_location_name(location_dat) >>> print(dat_and_note) ('Abercynon', 'formerly Abercynon South') >>> location_dat = 'Allerton (reopened as Liverpool South Parkway)' >>> dat_and_note = parse_location_name(location_dat) >>> print(dat_and_note) ('Allerton', 'reopened as Liverpool South Parkway') >>> location_dat = 'Ashford International [domestic portion]' >>> dat_and_note = parse_location_name(location_dat) >>> print(dat_and_note) ('Ashford International', 'domestic portion')