[newbie] Writing to file : "name 'concat' is not defined"?

Brian Quinlan brian at sweetapp.com
Wed Jul 21 10:37:48 EDT 2004


Fred wrote:
> On Wed, 21 Jul 2004 16:01:04 +0200, Brian Quinlan <brian at sweetapp.com>
> wrote:
> 
>>I don't see any reference to a "concat" function in either of those 
>>resources.
> 
> 
> Er...
> 
> Dive into Python : "Example 6.3. Opening a File" at the very
> beginning. No mention of an "open" statement, just concat. Same lower
> in "Example 6.7. Writing to Files".

Example 6.3. Opening a File

 >>> f = open("/music/_singles/kairo.mp3", "rb")
 >>> f
<open file '/music/_singles/kairo.mp3', mode 'rb' at 010E3988>
 >>> f.mode
'rb'
 >>> f.name
'/music/_singles/kairo.mp3'

Example 6.7. Writing to Files

 >>> logfile = open('test.log', 'w')
 >>> logfile.write('test succeeded')
 >>> logfile.close()
 >>> print file('test.log').read()
test succeeded
 >>> logfile = open('test.log', 'a')
 >>> logfile.write('line 2')
 >>> logfile.close()
 >>> print file('test.log').read()
test succeededline 2

> And in the Python Tutorial, jump to "7.2 Reading and Writing Files"
> The text mentions open(), but the samples don't show it, and use
> concat() instead.

Where is the usage of concat?

Cheers,
Brian



More information about the Python-list mailing list