diff --git a/files.html b/files.html index 5dd8b3f..4979725 100644 --- a/files.html +++ b/files.html @@ -225,8 +225,8 @@ ValueError: I/O operation on closed file. print('{} {}'.format(line_number, a_line.rstrip())) ③
with pattern, you safely open the file and let Python close it for you.
-for loop. That’s it. Besides having explicit methods like read(), the file object is also an iterator which spits out a single line every time you ask for a value.
-format() string method, you can print out the line number and the line itself. (The a_line variable contains the complete line, carriage returns and all. The rstrip() string method removes the trailing whitespace, including the carriage return characters.)
+for loop. That’s it. Besides having explicit methods like read(), the file object is also an iterator which spits out a single line every time you ask for a value.
+format() string method, you can print out the line number and the line itself. (The a_line variable contains the complete line, carriage returns and all. The rstrip() string method removes the trailing whitespace, including the carriage return characters.)