On Thu, Sep 22, 2016 at 8:36 PM, Malcolm Greene <pyt...@bdurham.com> wrote:
>> You could put something between the file and the reader ...
> Thank you both for your suggestions ... brilliant! You guys helped me
> solve my problem and gave me an excellent strategy for future scenarios.
This is why, despite the confusion it sometimes causes, we all prefer
duck typing to static typing. The csv.DictReader wants a "file-like
object", not necessarily a file - and in this case, all it asks is an
iterable of lines, so a simple generator will work. This is true of
MANY, if not all, places that a file is used.