On Wednesday 31 July 2002 17:50, Dekel Tsur wrote: > > > > Do you have any comment regarding the other code? > > Why do you remove the \n from each line (body.append(line[:-1]) > and then add it back ? It is a waste of time, but if it makes the code > simpler then it doesn't matter.
That is a reflex of the cases where I load data files and then split, there I need to strip the end line, so that it does not show in the resulting array. :-) I think that it makes the code simpler because sometimes you are comparing the full content of the line, and you don't need to remember to always put the extra \n. For example, to compare if the line is empty you do lines[i]=="" instead of lines[i]=="\n". I think that former is easier to understand and read. Althoug it takes some time, I don't think that time is a critical factor to us. It takes 3 seconds to parse the User Guide (150 Kb) here (pentiumII 400 MHz). > Also, what happens on a Windows machine: Doesn't the lines end with "\r\n" > ? No problem, remember the C from where this comes from. We only get the "\r\n" if we do a binary open: open("file","rb"). The same applies for writing. -- José Abílio