Re: working with csv module in python

Discussion in 'Python' started by Dave Angel, Feb 20, 2013.

  1. Dave Angel

    Dave Angel Guest

    On 02/20/2013 05:38 AM, inshu chauhan wrote:
    > On Wed, Feb 20, 2013 at 11:26 AM, Roland Koebler <> 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
    shortcuts.

    --
    DaveA
     
    Dave Angel, Feb 20, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Ortmann
    Replies:
    4
    Views:
    589
    Skip Montanaro
    Jul 2, 2003
  2. jliu66
    Replies:
    0
    Views:
    530
    jliu66
    Oct 19, 2007
  3. Roland Koebler

    Re: working with csv module in python

    Roland Koebler, Feb 20, 2013, in forum: Python
    Replies:
    0
    Views:
    137
    Roland Koebler
    Feb 20, 2013
  4. Peter Otten

    Re: working with csv module in python

    Peter Otten, Feb 20, 2013, in forum: Python
    Replies:
    0
    Views:
    173
    Peter Otten
    Feb 20, 2013
  5. Dave Angel

    Re: working with csv module in python

    Dave Angel, Feb 20, 2013, in forum: Python
    Replies:
    0
    Views:
    153
    Dave Angel
    Feb 20, 2013
Loading...

Share This Page