util.py 190 B

123456
  1. def get_input(p, fn=lambda a: a.strip()):
  2. with open(p) as f:
  3. return [fn(line) for line in f.readlines()]
  4. def transpose(grid):
  5. return [list(row) for row in list(zip(*grid))]