[Tutor] How to write a function which reads files
Rafael Knuth
rafael.knuth at gmail.com
Tue Aug 7 09:51:50 EDT 2018
> You forgot the parentheses (), and are returning a reference to the
> function instead of calling it and returning its result. Do this:
> contents = file_object.read()
oh, my bad. Thanks!
> Also, consider using snake_case instead of PascalCase for your
> function name, since the latter is typically used for classes, and
> perhaps call it read_file to better describe it?
thanks, I wasn't aware of the naming conventions for functions and classes.
will bear that in mind!
> Note that you used a different name here than in your
> function definition!
another typo. I made that in my original code already.
Thanks, everything works well now!
More information about the Tutor
mailing list