"Jay Mutter III" <[EMAIL PROTECTED]> wrote > for line in s: > jay = patno.findall(line) > jay2 = "".join(jay[0]) > print jay2 > > and it prints fine up until line 111 which is a line that had > previously returned [ ] since a number didn't exist on that line and > then exits with
> IndexError: list index out of range Either try/catch the exception or add an if not line: continue # or return a default string > And as long as i am writing, how can I delete a return at the end of > a line if the line ends in a certain pattern? > > For instance, if line ends with the abbreviation No. if line.endswith(string): line = line.rstrip() > I want to join the current line with next line. > Are lists immutable or can they be changed? lists can be changed, tuples cannot. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor