Wondering what the real difference is when writing files from Python. From what I can see if I use w or wb I am getting the same result with text.
I thought that saving as a binary file would show only binary values in a hex editor, but it also shows text and then ASCII version of that text.
Can both be used interchangably when saving text? (Windows User)
解决方案
Only in Windows, in the latter case, .write('\n') writes one byte with a value of 10. In the former case, it writes two bytes, with the values 13 and 10.
You can prove this to yourself by looking at the resulting file size, and examining the files in a hex editor.
In POSIX-related operating systems (UNIX, SunOS, MacOS, Linux, etc.), there is no difference beetween 'w' and 'wb'.