On Mar 22, 9:34 pm, [EMAIL PROTECTED] wrote: > self.headertxt = open("pages/header.html","r") > > *** Irrelevant code omitted *** > > headerp1 = "" > for i in range(5): > headerp1 += self.headertxt.readline() > headerp2 = self.headertxt.readline(7) > headerp3 = self.headertxt.readline() > headerp4 = self.headertxt.read() > return headerp1 + headerp2 + headerp3 + pagetitle + headerp4 > > Here is the textfile im reading: > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > > <head> > <title></title> > <meta name="Generator" content="EditPlus" /> > <meta name="Author" content="Adam W." /> > <meta name="Description" content="Blah Blah Blah" /> > </head>""" > > and here is the output: > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > > <head> > <title> > this is a new title > </title> > <meta name="Generator" content="EditPlus" /> > <meta name="Author" content="Adam W." /> > <meta name="Description" content="Blah Blah Blah" /> > </head>""" > > As you can see what I was trying to acheive was <title>the title</ > title> all on the same line. Help!
Where can I see that? From the python language documentation here: http://docs.python.org/lib/lib.html you can look up readline() and see: ---------- readline( [size]) Read one entire line from the file. A trailing newline character is kept in the string --------- There is a function called strip() that will strip off all leading and trailing whitespace on a string, e.g. a newline. -- http://mail.python.org/mailman/listinfo/python-list