problem with read() write()

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sun Nov 1 12:29:24 CET 2009


On Sun, 01 Nov 2009 10:44:45 +0100, Alf P. Steinbach wrote:

> Could you post (copy and paste) the code, and description of results?

Using Python 2.6 under Linux (Fedora 7):

>>> f = open('garbage', 'r')  # prove the file doesn't exist
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'garbage'
>>> f = open('garbage', 'wb+')
>>> f.read(4)
''
>>> f.write('hello world\n')
>>> f.seek(0)
>>> f.read(100)
'hello world\n'


-- 
Steven



More information about the Python-list mailing list