Laszlo Nagy napisaĆ(a): >> Nope. StringI is an input-only object, StringO is an output object. >> You got a StringI because you gave a string argument to the creator. >> >> >> >>> f1 = cStringIO.StringIO() >> >>> f1 >> <cStringIO.StringO object at 0x186c9c00> >> >>> dir(f1) >> ['__class__', '__delattr__', '__doc__', '__getattribute__', >> '__hash__', '__init__', '__iter__', '__new__', '__reduce__', >> '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'close', >> 'closed', 'flush', 'getvalue', 'isatty', 'next', 'read', 'readline', >> 'readlines', 'reset', 'seek', 'softspace', 'tell', 'truncate', >> 'write', 'writelines'] >> >>> f2 = cStringIO.StringIO("This is the fixed content of the StringIO") >> >>> f2 >> <cStringIO.StringI object at 0x18661440> >> >>> dir(f2) >> ['__class__', '__delattr__', '__doc__', '__getattribute__', >> '__hash__', '__init__', '__iter__', '__new__', '__reduce__', >> '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'close', >> 'closed', 'flush', 'getvalue', 'isatty', 'next', 'read', 'readline', >> 'readlines', 'reset', 'seek', 'tell', 'truncate'] > > Is it possible to have a direct access in-memory file that can be > written and read too?
Read it again. You get readable-and-writable object by *not* assigning initial value in constructor. -- Jarek Zgoda http://jpa.berlios.de/ -- http://mail.python.org/mailman/listinfo/python-list