Skip to content

Instantly share code, notes, and snippets.

@vlad-ds
Last active May 26, 2021 15:34
Show Gist options
  • Save vlad-ds/9c6a467770bc837cb92ddc76b399ba8e to your computer and use it in GitHub Desktop.
Save vlad-ds/9c6a467770bc837cb92ddc76b399ba8e to your computer and use it in GitHub Desktop.
import ast
from typing import List
from os import listdir
def get_streamings(path: str = 'MyData') -> List[dict]:
files = ['MyData/' + x for x in listdir(path)
if x.split('.')[0][:-1] == 'StreamingHistory']
all_streamings = []
for file in files:
with open(file, 'r', encoding='UTF-8') as f:
new_streamings = ast.literal_eval(f.read())
all_streamings += [streaming for streaming
in new_streamings]
return all_streamings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment