string join() method

Derek Basch dbasch at yahoo.com
Thu Mar 24 00:37:51 CET 2005


Can anyone tell me why this CGI code outputs a blank page?
--------------------------------
self.output = []
self.setContentType("text/plain")
ascii_temp.seek(0)
self.output.extend(ascii_temp.read())
print ''.join(self.output)

def setContentType(self, type="text/xml"):
    self.output.extend(["Content-type: ", type, "\n\r"])
---------------------------------

but this code works?:
---------------------------------
self.output = []
self.setContentType("text/plain")
print ''.join(self.output)
ascii_temp.seek(0)
print ascii_temp.read()

def setContentType(self, type="text/xml"):
    self.output.extend(["Content-type: ", type, "\n\r"])
---------------------------------

ascii_temp is just some tab seperated data:
---------------------------------
Allele	Seq:Start-End	Length	Sequence	Score
A01	1: 1-8	8	SSSSSSSS	1410538.0
A01	1: 2-9	8	SSSSSSSS	1410538.0
---------------------------------

Thanks everyone.
Derek Basch




More information about the Python-list mailing list