[Tutor] re adlines, read, and my own get_contents()

John [H2O] washakie at gmail.com
Thu Jun 19 08:44:03 CEST 2008


I've defined:

def get_contents(infile=file_object):
   """ return a list of lines from a file """
   contents=infile.read()
   contents = contents.strip().split('\n')
   return contents

then there's also:

file_object.read()

and 

file_object.readlines()

and

file_object.readline()

I think I understand the differences, but can someone tell me if there's any
difference between what I define and the readlines() method?

-john
-- 
View this message in context: http://www.nabble.com/readlines%2C-read%2C-and-my-own-get_contents%28%29-tp17998300p17998300.html
Sent from the Python - tutor mailing list archive at Nabble.com.



More information about the Tutor mailing list