[Tutor] (no subject)

Shashwat Anand anand.shashwat at gmail.com
Wed Sep 15 01:39:27 CEST 2010


On Wed, Sep 15, 2010 at 1:38 AM, Sukhpal Saini <sunny_ashi1 at hotmail.com>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  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
~l0nwlf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100915/97da31ae/attachment.html>


More information about the Tutor mailing list