Linux > python > file-I/O ?

gene tani gene.tani at gmail.com
Sat Dec 24 13:59:19 EST 2005


news at absamail.co.za 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 ?
>
> 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 ?
>
> Thanks for any info.
>
> == Chris Glur.

i don't think there's a specific list for linux, only for mac and win32
http://mail.python.org/mailman/listinfo

if you're wanting file size, you need to os.stat()
http://docs.python.org/lib/os-file-dir.html




More information about the Python-list mailing list