Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76465

Re: error with files

References <77b81003-3a5d-4a54-b609-e0f0b6f1d0de@googlegroups.com>
Date 2014-08-18 11:07 +0100
Subject Re: error with files
From Paul Wiseman <poalman@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.13092.1408356439.18130.python-list@python.org> (permalink)

Show all headers | View raw


The line should be:

file1.write(file_data)

you could write

file.write(file1, file_data)

but that would be an odd way to do it :)

On 18 August 2014 10:41, ngangsia akumbo <ngangsia@gmail.com> wrote:
> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

error with files ngangsia akumbo <ngangsia@gmail.com> - 2014-08-18 02:41 -0700
  Re: error with files Paul Wiseman <poalman@gmail.com> - 2014-08-18 11:07 +0100
    Re: error with files ngangsia akumbo <ngangsia@gmail.com> - 2014-08-18 03:34 -0700
  Re: error with files Peter Otten <__peter__@web.de> - 2014-08-18 12:09 +0200
  Re: error with files Rock Neurotiko <miguelglafuente@gmail.com> - 2014-08-18 11:48 +0200

csiph-web