Nice. I also split on \n\n and reverse the lines that denote the crates, and after that it's not so bad. islice would've been handy, I need to dig into that itertools library at some point (although probably only for AOC purposes!)
The thing to note is that the "stack" part of the input has trailing whitespace, so you can go from line-by-line based input to column-based input with zip(*stacks.split("\n")), then it's just a question of picking out the bits you need.
Nice. I also split on
\n\n
and reverse the lines that denote the crates, and after that it's not so bad.islice
would've been handy, I need to dig into thatitertools
library at some point (although probably only for AOC purposes!)