April 24, 2024, 1:19 p.m. | Kathryn DiPippo

DEV Community dev.to

This is a blog post just for me, but it's all of the Python snippets I repeatedly look up or reference from other parts of my codebase.





Snippets List



  • Read File into Words

  • Read JSON File into Dict





Read File Into Words



def read_file_into_words(filename: str) -> list[list[str]]:
"""Parse a text file into a 2D list of words, i.e.
"This is an example file with
multiple lines of text" becomes
[["This", "is", "an", "example", "file", "with"],
"multiple", "lines", "of", "text"].

Args: …

blog codebase file json list look look up python reference text words

Founding AI Engineer, Agents

@ Occam AI | New York

AI Engineer Intern, Agents

@ Occam AI | US

AI Research Scientist

@ Vara | Berlin, Germany and Remote

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne