sg wrote: > hi,,,, > i am new to python. i want help in regular expression.. anyone explain > or guide me for following problem.. > > the content of txt file is splitted using the pipe | symbol and sorted . > then the field in the first row is compared with field in the second row and > the second row field is compared with third and so on till end of file.. if > there is mismatch between the row, the error will be throw as follows.. > For example, > > david thomson > davis thomson > > in above string 'd' and 's' are mismatched.. so the error will be thrown.
I don't think you need regular expressions for this. What do you mean by mismatched? any difference between them, or something more subtle? If you compare the first row to the second, the second to the third, etc, then you will get the error unless every line is the same. Is that what you want? If I understand you, what you want to do can be done with a simple loop over the lines with a variable that remembers the value of the previous line. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor