> For this simple example, this solution is fine, and I think the > solution > proposed by Alan (StringIO) is not going to add anything. Would it > be faster?
Probably not, the StringIO solution is just closer to how you described the problem, but also provides a fuller set of file-like methods, including seek(): >>> import StringIO >>> s = StringIO.StringIO() >>> s.write(''' ... here is some text ... that you can see''') >>> s.read() # at eof '' >>> s.seek(0) >>> s.read() # at start of file '\nhere is some text\nthat you can see' >>> 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