error with files

Rock Neurotiko miguelglafuente at gmail.com
Mon Aug 18 05:48:45 EDT 2014


You are trying to write the open file (file1) in the file type.

I think that you wanted to write in file1, the data:

file1.write(file_data)   # instead of file.write(file1)


2014-08-18 11:41 GMT+02:00 ngangsia akumbo <ngangsia at gmail.com>:

> error
>
> yems ~ # nano testfile1
> yems ~ # python  testfile1
> Enter file name: g
> write in data:  g
> Traceback (most recent call last):
>   File "testfile1", line 11, in <module>
>     file.write(file1)
> TypeError: function takes exactly 1 argument (0 given)
>
>
>
> import os.path
>
> save_here = '/home/yems/newfile/'
> file_name = raw_input("Enter file name: ")
> filesname = os.path.join(save_here, file_name+".txt")
>
> file1 = open(filesname, 'w')
>
> file_data = raw_input('write in data:  ')
>
> file.write(file1)
>
> file1.close()
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Miguel García Lafuente - Rock Neurotiko

Do it, the devil is in the details.
The quieter you are, the more you are able to hear.
Happy Coding. Code with Passion, Decode with Patience.
If we make consistent effort, based on proper education, we can change the
world.

El contenido de este e-mail es privado, no se permite la revelacion del
contenido de este e-mail a gente ajena a él.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140818/2b9e7975/attachment.html>


More information about the Python-list mailing list