Esempio n. 1
0
def load_words():
    with path.load_file("p042_words.txt") as f:
        return [w.strip('"') for w in f.read().split(",")]
def load_triangle():
    with path.load_file("p018_triangle.txt") as r:
        for line in r.readlines():
            numbers = line.split(" ")
            yield list(map(lambda n: int(n.strip()), numbers))
def load_numbers():
    with load_file("p013_numbers.txt") as r:
        return [int(n) for n in r]
def load_number():
    with load_file("p008_number.txt") as r:
        return r.read().strip()
def load_names():
    with path.load_file("p022_names.txt") as r:
        contents = r.read()
        names = [x.strip('"') for x in contents.split(",")]

    return sorted(names)
Esempio n. 6
0
def load_grid():
    with load_file("p011_grid.txt") as r:
        return [[int(num) for num in line.strip().split(" ")] for line in r]