Add utility functions
This commit is contained in:
1 parent
5a346baa01
commit
9d72cb396d
2 files changed
+13
No files matched your search
@@ -0,0 +1,13 @@
|
||||
from pathlib import Path
|
||||
|
||||
def data_as_string(data_file: Path) -> str:
|
||||
with open(data_file) as file:
|
||||
return file.read().strip()
|
||||
|
||||
|
||||
def data_as_list(data_file: Path) -> list:
|
||||
return [line for line in data_as_string(data_file).strip()]
|
||||
|
||||
|
||||
def data_as_int_list(data_file: Path) -> list:
|
||||
return [int(line) for line in data_as_string(data_file).strip()]
|
||||
Reference in new issue
Block a user