[EMAIL PROTECTED] wrote: > I've just started to test/learn python. > I've got Linux > mandrake9 > python & documentation. > What I'll initially want to be doing needs file I/O, so I > wanted to confirm file I/O early in my tests. > > Following the examples : >>>> f=open('/tmp/workfile', 'w') >>>> print f > <open file '/tmp/workfile', mode 'w' at 80a0960> <-- OK > > But: >>>> f.read(size) > Traceback (most recent call last): > File "<stdin>", line 1, in ? > NameError: name 'size' is not defined <-- ?? Obj-method unknown ?? > > > What's wrong ? >
size should be a number of bytes to read. E.g.: f.read(1000) would read 1000 bytes. The size is optional: f.read() would read the entire file in one hit. Beware doing this on huge files that could run you out of memory. > I read: "The set of such modules is a configuration > option which also depends on the underlying platform." > My documenation refers also to Mac & Win installations. > Is there a linux > python NewsGroup ? > Not that I know of. Python is much the same whatever platform it is on. The problem you see above would be exactly the same on Linux, Windows or any other O/S. Just remember to say what O/S when you post problems, just in case it's relevant. Steve -- http://mail.python.org/mailman/listinfo/python-list