"aiwarrior" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If file.WriteLines( seq ) accepts a list and it says it writes lines, > why does it write the whole list in a single line. Be cause of that > the reverse of file.writelines(seq) is not file.readlines(). > Are the assumptions i made correct? If yes why is this so?
readlines() and writelines() are complimentary. readlines() leaves the line terminators intact. It does not strip them off. writelines() does not add in carriage returns for the same reason. For example: >>> D=open("temp.txt").readlines() >>> D ['the quick\n', 'brown fox\n', 'jumps over\n', 'the lazy dog.'] >>> open("temp2.txt","w").writelines(D) will create temp2.txt to be identical to temp.txt. -- http://mail.python.org/mailman/listinfo/python-list