Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news2.euro.net!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'output': 0.04; 'method.': 0.05; 'method,': 0.07; 'shutil': 0.07; 'read()': 0.09; 'subject:module': 0.09; 'windows,': 0.09; 'subject:python': 0.11; 'files.': 0.13; 'file,': 0.15; '(read': 0.16; 'concat': 0.16; 'copying.': 0.16; 'delimiters': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'input': 0.18; 'feb': 0.19; 'module': 0.19; 'linux': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'am,': 0.27; "doesn't": 0.28; 'folder': 0.30; 'file': 0.32; 'to:addr:python-list': 0.33; 'open': 0.35; 'but': 0.36; 'anything': 0.36; 'subject:with': 0.36; 'should': 0.36; 'possible': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'mean': 0.38; 'some': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'your': 0.60; 'further': 0.61; "you'll": 0.62; 'necessarily': 0.63; 'more': 0.63; '20,': 0.65; 'else.': 0.65; 'skip:c 50': 0.66; 'received:74.208': 0.71; 'attention': 0.75; '2013': 0.84; 'mechanics': 0.84; 'write()': 0.91 Date: Wed, 20 Feb 2013 06:04:11 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: python-list@python.org Subject: Re: working with csv module in python References: <20130220102601.GD22457@localhost> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:3Df1xebuHAN5D/tb+OXQ+ceaZj0CRnzMMCD5TJ2vXS1 PbCNoQY2dJJBcOwBWPDLSPmOZ0pvb3nZDV3GpvR+SxAwMgvEj5 WOmoXSs5v9AigpfH/a0smceAPEwrUncuiNwWnfCAdylQLrL3ll HUCM2tpkI0jSDllfyJlfwziRpFsAcv4DGOcfSRGnBktSDLzpAe rWDRor3BVrNYU/Rxc9ciZbYs+4Ogs1Xe6KLXvVd+NZyfJiuxgg fMmN3XW5c1gObh3uenQRHlTtFo9cOOodAnBDxKJlDUEf8WKimo 5tzb6832I0IKFetB3hFwi3quwyg2mMljw2AFjaD2IjhCFxrwQ= = 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: 1361358263 news.xs4all.nl 6944 [2001:888:2000:d::a6]:42376 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39345 On 02/20/2013 05:38 AM, inshu chauhan wrote: > On Wed, Feb 20, 2013 at 11:26 AM, Roland Koebler wrote: > >> >> >> >> If you only want to concat the files, I would use some shell-tools, >> like "cat" on Linux or "copy" on Windows, so >> >> copy C:\Users\inshu.chauhan\Desktop\ForModel_600\*.arff >> C:\Users\inshu.chauhan\Desktop\test2.arff >> >> should do it. >> >> >> > Yes I just want to concat the files , not parse/mangle the files. How can > i simply read all files in a folder in my computer and write them into a > single file ? just by 'printf ' is it possible ? > > > Reread Roland's message, quoted above for your convenience. Not sure what you mean by printf. Why would you use C to do it? If you need to do it in Python, remember you can read a file with the read() method, and write one with the write() method. They pay no attention to newlines, delimiters or anything else. Just create the output file, then in a loop open the input files and loop through each (read doesn't necessarily get the whole thing in one pass) You'll spend lots more energy on the mechanics of finding the files then on the copying. But perhaps the shutil module will have some further shortcuts. -- DaveA