Wolfgang Maier wrote: > What will my IO object return then when I read from it in Python 2.7? str > where Python3 gives bytes, and unicode instead of str ? This is what I > understood from the Python 2.7 io module doc.
You can always double-check in the interpreter: >>> with open("tmp.txt", "w") as f: f.write("let's try\n") ... >>> import io >>> with io.open("tmp.txt", "r") as f: print type(f.read()) ... <type 'unicode'> >>> with io.open("tmp.txt", "rb") as f: print type(f.read()) ... <type 'str'> So yes. Also: >>> str is bytes True -- http://mail.python.org/mailman/listinfo/python-list