Open the file in text mode, read it, and close the file.
(self, encoding=None, errors=None, newline=None)
| 778 | return f.read() |
| 779 | |
| 780 | def read_text(self, encoding=None, errors=None, newline=None): |
| 781 | """ |
| 782 | Open the file in text mode, read it, and close the file. |
| 783 | """ |
| 784 | # Call io.text_encoding() here to ensure any warning is raised at an |
| 785 | # appropriate stack level. |
| 786 | encoding = io.text_encoding(encoding) |
| 787 | with self.open(mode='r', encoding=encoding, errors=errors, newline=newline) as f: |
| 788 | return f.read() |
| 789 | |
| 790 | def write_bytes(self, data): |
| 791 | """ |