Skip to content

Commit 7f2fff8

Browse files
authored
Update 7.-input-and-output.md
1 parent aa74ba0 commit 7f2fff8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

7.-input-and-output.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@ ValueError: I/O operation on closed file
213213

214214
#### 7.2.1. Các phương thức sử dụng cho đối tượng file
215215

216-
The rest of the examples in this section will assume that a file object called `f` has already been created.
216+
Các ví dụ còn lại trong phần này giả định rằng một đối tượng file gọi là `f` đã được tạo ra.
217217

218-
To read a file’s contents, call `f.read(size)`, which reads some quantity of data and returns it as a string \(in text mode\) or bytes object \(in binary mode\). _size_ is an optional numeric argument. When _size_ is omitted or negative, the entire contents of the file will be read and returned; it’s your problem if the file is twice as large as your machine’s memory. Otherwise, at most _size_ bytes are read and returned. If the end of the file has been reached, `f.read()` will return an empty string \(`''`\).>>>
218+
Để đọc nội dung 1 file, gọi hàm `f.read(size)`, hàm này đọc một lượng dữ liệu chỉ ra ở biến _size_ và trả về 1 chuỗi \(ở chế độ text\) or đối tượng byte \(ở chế độ nhị phân)._size_ là một tham số kiểu số tùy chọn. Khi _size_ được bỏ qua hoặc là số âm, toàn bộ nội dung file sẽ được đọc và được trả về trong 1 chuỗi; Sẽ là vấn đề nếu file lớn gấp đôi dung lượng bộ nhớ của máy. Ở trường hợp trên, số lượng dữ liệu tối đa có thể đọc và được trả về. Khi đọc tới cuối file, hàm `f.read()` trả về một chuỗi rỗng \(`''`\).>>>
219219

220220
```text
221221
>>> f.read()

0 commit comments

Comments
 (0)