Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'argument': 0.05; 'odd': 0.07; 'data:': 0.09; 'os.path': 0.09; 'subject:files': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; "'w')": 0.16; 'be:': 0.16; 'file1': 0.16; 'file_name': 0.16; 'given)': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; 'import': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'file': 0.32; 'url:python': 0.33; '(most': 0.33; 'could': 0.34; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'should': 0.36; 'skip:o 20': 0.38; 'recent': 0.39; 'url:mail': 0.40; 'august': 0.61; 'name:': 0.61; 'to:addr:gmail.com': 0.65 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=9N2aUs21ZUN710pCu2po1NGmC+Qc9DsNd/jZaoUHz14=; b=vRiAbIhqH0/mN98B7drtC4DlQ+iEN4Clw9t5zCKJQlOiPA0hrm8IQUbFxWKpszmYo7 q1Vo2i6JQ5rouwxOLtPo2NKaMggS5a29fOUeidecBxYzCEMICbcW8EpQspxrdXZVz9ow QYADeZcqmqjBGVMnYDhguREiAQ61McCZpGeGC60Kohif9NPx073K+NVcuXBYPXh4uMKF wCmBkwaWiF1BULOViS+wZO5+i/A144+tVKjXuM4nhAqsE77f/7NQRcdAGkGTc/jJ3Q07 KrGmpywwnc5dO7aamXi9TQV4PKCm0TmY7/KoHPZcKVC7uNkftyZPcLbNDj9tzrbodEdJ /fPw== MIME-Version: 1.0 X-Received: by 10.194.119.41 with SMTP id kr9mr7511929wjb.114.1408356431270; Mon, 18 Aug 2014 03:07:11 -0700 (PDT) In-Reply-To: <77b81003-3a5d-4a54-b609-e0f0b6f1d0de@googlegroups.com> References: <77b81003-3a5d-4a54-b609-e0f0b6f1d0de@googlegroups.com> Date: Mon, 18 Aug 2014 11:07:11 +0100 Subject: Re: error with files From: Paul Wiseman To: ngangsia akumbo Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1408356439 news.xs4all.nl 2893 [2001:888:2000:d::a6]:52054 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76465 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 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 > 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