Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: working with csv module in python

Thread Tools

Re: working with csv module in python

Dave Angel
Posts: n/a
On 02/20/2013 05:38 AM, inshu chauhan wrote:
> On Wed, Feb 20, 2013 at 11:26 AM, Roland Koebler <(E-Mail Removed)> wrote:
>> <snip>
>> 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.
>> <snip>

> 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

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: working with csv module in python Dave Angel Python 0 02-20-2013 11:22 AM
Re: working with csv module in python Peter Otten Python 0 02-20-2013 10:58 AM
Re: working with csv module in python Roland Koebler Python 0 02-20-2013 10:26 AM
read and write csv file using csv module jliu66 Python 0 10-19-2007 03:12 PM
Python-2.3b1 bugs on Windows2000 with: the new csv module, stringreplace, and the re module Daniel Ortmann Python 4 07-02-2003 03:23 PM