Parsing files with Python's generator expressions and walruses

Опубликовано: 10 Ноябрь 2020
на канале: Python and Pandas with Reuven Lerner
1,373
53

Python is great at parsing files — but what if the file is really huge? That's where generators come in. How can you turn existing code into a generator function? And can you go even further, turning it into a generator comprehension? The answer: Yes, with a bit of help from the new "walrus" operator. Join me in this exploration of code I got from Doug, a long-time subscriber to my "Better developers" list (https://BetterDevelopersWeekly.com/), where we explore file parsing, generator expressions, and walruses!