import csv as _csv


def search_ap(key):
    with open("allairports.csv", encoding="utf-8") as cf:
        r = _csv.reader(cf)
        for row in r:
            if row[1] == key.upper():
                return [row[10], row[4], row[5]]
    return [False, key]


def aps():
    lats = []
    longs = []
    names = []
    with open("airports.csv") as cf:
        r = _csv.reader(cf)
        for row in r:
            item = row[0].upper()
            s = search_ap(item)
            names.append(item)
            #names.append(s[0])
            lats.append(float(s[1]))
            longs.append(float(s[2]))

    return lats, longs, names

import csv as _csv


def search_ap(key):
    with open("allairports.csv", encoding="utf-8") as cf:
        r = _csv.reader(cf)
        for row in r:
            if row[1] == key.upper():
                return [row[10], row[4], row[5]]
    return [False, key]


def aps():
    lats = []
    longs = []
    names = []
    with open("airports.csv") as cf:
        r = _csv.reader(cf)
        for row in r:
            item = row[0].upper()
            s = search_ap(item)
            names.append(item)
            #names.append(s[0])
            lats.append(float(s[1]))
            longs.append(float(s[2]))

    return lats, longs, names

#names.append(s[0])