On Wed, Sep 15, 2010 at 1:38 AM, Sukhpal Saini <[email protected]>wrote:
> Hi! I have a problem. I just started python. when I use (open) function,
> is the file supposed to open? Because it doesn't.
>
f = open('filename', 'r') opens the file in read-only format. There are
others like binary, write, append etc. Check the manual for that.
To read it you need to use read() or readline()
Ex, s = f.read()
Now s will be a string containing the contents of file.
> _______________________________________________
> Tutor maillist - [email protected]
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
--
~l0nwlf
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor