On 9/22/2014 3:34 PM, [email protected] wrote:
On Thu, Sep 18, 2014, at 14:45, Chris Kaynor wrote:Additionally, you may want to specify binary mode by using open(file_path, 'rb') to ensure platform-independence ('r' uses Universal newlines, which means on Windows, Python will convert "\r\n" to "\n" while reading the file). Additionally, some platforms will treat binary files differently.Does 'r' not use universal newlines on unix?
'r' in the open mode means 'read', versus 'w' for 'write' and 'a' for 'append'. 'b' means 'binary', versus 't' for 'text'. I am pretty sure universal newlines only applies to text mode, as least in 3.x.
-- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
