On 04/30/2015 01:06 AM, Cecil Westerhof wrote:
[snip]
I wrote a module where I have:
def get_indexed_message(message_filename, index):
"""
Get index message from a file, where 0 gets the first message
"""
return open(expanduser(message_filename),
'r').readlines()[index].rstrip()
Very minor nit unrelated to the file closing question:
This would be a good place to give index a default value...
def get_indexed_message(message_filename, index=0):
...
-=- Larry -=-
--
https://mail.python.org/mailman/listinfo/python-list