> I want to use the module StringIO as read and write strings as files, I > looked into document but cannot understand. Could anyone give me a > simple example? > > something like: > from StringIO import * > fin = StringIO("abc") > ..... > How can I used fin?
'fin' is a file-like object at this point, so you can do things like: fin.read(1) to get a single byte. The list of things we can do with file-like objects is here: http://www.python.org/doc/lib/bltin-file-objects.html Does this help? Good luck! _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor