Message309672
print() converts all its arguments to string by calling str(). The resulting strings are written to the output file.
print(bin_buff, file=fp) is equivalent to
fp.write(str(bin_buff))
fp.write('\n')
If you will run Python with options -b or -bb you will get a warning or an error from str(bin_buff) because this operation can be ambiguous. It is better to use an explicit repr() for converting bytes to str if you want to get the representation of the bytes object as a Python literal, or convert it to a string with specifying explicit encoding: str(bin_buff, 'utf-8') or bin_buf.decode('utf-8'). |
|
Date |
User |
Action |
Args |
2018-01-08 16:07:38 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, lopgok |
2018-01-08 16:07:38 | serhiy.storchaka | set | messageid: <1515427658.88.0.467229070634.issue32520@psf.upfronthosting.co.za> |
2018-01-08 16:07:38 | serhiy.storchaka | link | issue32520 messages |
2018-01-08 16:07:38 | serhiy.storchaka | create | |
|