On May 16, 2:12 am, globalrev <[EMAIL PROTECTED]> wrote:
> import os
>
> print os.path.exists('C:/Python25/myPrograms/netflix/test.txt')
> d=open('C:/Python25/myPrograms/netflix/flim.txt', 'r')

Two different paths again.

> d.readline()

This reads one line and then does absolutely nothing with it. The
Python interactive shell prints the result of each expression, which
is a Good Thing. For Python to do the same when running a script would
be a Bad Thing.

readline and readlines are old hat; instead, iterate over the file
object, like this:

for line in d:
    print line,

>
> returns true in the shell but prints no text even though the document
> contains text.
>
> d.name returns nothing, d.name() raises an error.

d.name should return the name of the file; I suspect that you again
have done nothing with it. d.name() would raise an exception because
d.name is not a method, so you can't call it.

HTH,
John
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to