Reading/Writing files

Jack Trades jacktradespublic at gmail.com
Fri Mar 18 17:59:36 EDT 2011


On Fri, Mar 18, 2011 at 4:56 PM, Jon Herman <jfc.herman at gmail.com> wrote:

> Jack,
>
> thanks.
>
> Alright, so what I did is create a file called hello.txt with a single line
> of text in there. I then did the following:
>
> f="fulldirectory\hello.txt" (where fulldirectory is of course the actual
> full directory on my computer)
> open("f", "w")
>
> And I get the following error: IOError: [Errno 13] Permission denied: 'f'
> If I open to read, I get: IOError: [Errno 2] No such file or directory: 'f'
>
> Can anyone explain to me why this happens?
>
>
You need to remove the quotes from f.  f is a variable name, not a string,
so there should be no quotes around it.

-- 
Jack Trades
Pointless Programming Blog <http://pointlessprogramming.wordpress.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110318/b975bd29/attachment-0001.html>


More information about the Python-list mailing list