[Tutor] (no subject)

Dave Angel davea at ieee.org
Sat Jan 9 12:32:44 CET 2010


sudhir prasad wrote:
> hi,
> iam a beginner.
>
> sample_file = file("/home/ee08m082/Desktop/python/123.txt","w")
> sample_file.write("About Pythons\n")
>
> in the above two line code,123.txt is being created but "About Pythons" is
> not being written in the file.
> my OS is  redhat  linux and python version is 2.3.4
>
> thanks
>
>   
You forgot to close the file.
    sample_file.close()

DaveA



More information about the Tutor mailing list