Created
February 8, 2020 05:19
-
-
Save pschanely/93f54161c4bda3a3bf93fe7f7d598d29 to your computer and use it in GitHub Desktop.
Shared via CrossHair Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List | |
def csv_last_column(lines: List[str]) -> List[str]: | |
''' | |
Gets you the last column from a csv. | |
We use CrossHair to confirm our index arithmetic is correct. | |
pre: all(',' in line for line in lines) | |
post: __return__ == [line.split(',')[-1] for line in lines] | |
''' | |
return [line[line.rindex(',') + 1:] for line in lines] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment