mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
open() is a function (well not really, but calling it a method in one sentence and a function in the next just seems wrong)
This commit is contained in:
+1
-1
@@ -279,7 +279,7 @@ ValueError: zero length field name in format</samp></pre>
|
||||
|
||||
<p>You can write to files in much the same way that you read from them. First you open a file and get a stream object, then you use methods on the stream object to write data to the file, then you close the file.
|
||||
|
||||
<p>To open a file for writing, use the <code>open()</code> method and specify the write mode. There are two file modes for writing:
|
||||
<p>To open a file for writing, use the <code>open()</code> function and specify the write mode. There are two file modes for writing:
|
||||
|
||||
<ul>
|
||||
<li>“Write” mode will overwrite the file. Pass <code>mode='w'</code> to the <code>open()</code> function.
|
||||
|
||||
Reference in New Issue
Block a user