From d9464bb1de4ba4c5c5faea82dfb4218457a9a6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Mon, 18 Mar 2019 06:11:18 +0100 Subject: [PATCH] File --- README.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a4c7b6f..15d2f36 100644 --- a/README.md +++ b/README.md @@ -1070,11 +1070,23 @@ Open * **`'t'` - Text mode (default).** * **`'b'` - Binary mode.** -### Seek +### File ```python -.seek(0) # Move to the start of the file. -.seek(offset) # Move 'offset' chars/bytes from the start. -.seek(offset, ) # Anchor: 0 start, 1 current pos., 2 end. +.seek(0) # Move to the start of the file. +.seek(offset) # Move 'offset' chars/bytes from the start. +.seek(offset, ) # Anchor: 0 start, 1 current pos., 2 end. +``` + +```python + = .read(size=-1) # Reads 'size' chars/bytes or until EOF. + = .readline() # Returns a line. + = .readlines() # Returns a list of lines. + = next() # Returns a line using buffer. Do not mix. +``` + +```python +write() # Writes a string or bytes object. +writelines() # Writes a list of strings or bytes objects. ``` ### Read Text from File