(data)
| 763 | return |
| 764 | |
| 765 | def write(data): |
| 766 | if not isinstance(data, basestring): |
| 767 | data = str(data) |
| 768 | # If the file has an encoding, encode unicode with it. |
| 769 | if (isinstance(fp, file) and |
| 770 | isinstance(data, unicode) and |
| 771 | fp.encoding is not None): |
| 772 | errors = getattr(fp, "errors", None) |
| 773 | if errors is None: |
| 774 | errors = "strict" |
| 775 | data = data.encode(fp.encoding, errors) |
| 776 | fp.write(data) |
| 777 | want_unicode = False |
| 778 | sep = kwargs.pop("sep", None) |
| 779 | if sep is not None: |
no test coverage detected