Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39336
| Path | csiph.com!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <insideshoes@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'attribute': 0.05; 'column': 0.07; 'python': 0.09; 'delimited': 0.09; 'delimiter': 0.09; 'rows': 0.09; 'subject:module': 0.09; 'windows,': 0.09; 'subject:python': 0.11; 'files.': 0.13; 'resulting': 0.13; 'columns': 0.16; 'concat': 0.16; 'csv': 0.16; 'prog': 0.16; 'row': 0.16; 'x,y,z': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'feb': 0.19; 'module': 0.19; 'code.': 0.20; 'to:name:python-list@python.org': 0.20; 'file.': 0.20; 'trying': 0.21; '>': 0.23; 'so.': 0.24; 'linux': 0.24; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'merge': 0.27; 'module.': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; '+0100,': 0.29; 'them?': 0.29; 'skip:& 10': 0.29; 'source': 0.29; 'folder': 0.30; 'error': 0.30; 'file': 0.32; 'null': 0.33; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'skip:& 20': 0.33; 'received:google.com': 0.34; 'text': 0.34; 'so,': 0.35; 'open': 0.35; 'something': 0.35; 'there': 0.35; 'subject:with': 0.36; 'should': 0.36; 'possible': 0.37; 'why': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'some': 0.38; 'gives': 0.39; 'to:addr:python.org': 0.39; 'space': 0.39; 'skip:" 10': 0.40; 'your': 0.60; 'first': 0.61; 'between': 0.63; 'dont': 0.64; '20,': 0.65; 'skip:c 50': 0.66; '2013': 0.84; '299': 0.84; 'contents,': 0.84; 'writing,': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=MiR+/rdAB12n1xBbQFHFSen8kI86TIEkEOslZuUqO9Q=; b=ActcQgxYDIOSLlOcSPN09Q0bXD7o/MYkI4n3S2HaEUra5Gwo/G+a8Rt/UcPRlEhOyI FlJet5pdK+jJNFIRP7TlAegHBGg3Z9o4ONztpdR86NzTpgoDJs7JxF8dfhwgj8Re4BWN elIMladBdoSi6P1T5fWCu/5EmNgWMrcOCQd5QIizV8hxqgz643qmpnqnQp3pXCBSETXh IhkXSwGejzjJ22Mh1SXOZQsWCt6sE99g0u5z5Dso9dZKESnKvs8VoGOBASc6gFODItJl nbbNLzB2ODZt9tUgJo02RPpxtFObwOmjJwc9+U+h7hgs+qg9DoF2cQUAHy0k3avHiMFM rPnA== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.219.228 with SMTP id pr4mr10710430igc.40.1361356707675; Wed, 20 Feb 2013 02:38:27 -0800 (PST) |
| In-Reply-To | <20130220102601.GD22457@localhost> |
| References | <CAFqGZRG3wVyf6jMBESjr6bmnLhLsT-_BG0xSH_rcpe4Oqb+1nQ@mail.gmail.com> <20130220102601.GD22457@localhost> |
| Date | Wed, 20 Feb 2013 11:38:27 +0100 |
| Subject | Re: working with csv module in python |
| From | inshu chauhan <insideshoes@gmail.com> |
| To | "python-list@python.org" <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=bcaec555513cf93dd804d6258e45 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2098.1361356715.2939.python-list@python.org> (permalink) |
| Lines | 107 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1361356715 news.xs4all.nl 6976 [2001:888:2000:d::a6]:46958 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:39336 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On Wed, Feb 20, 2013 at 11:26 AM, Roland Koebler <r.koebler@yahoo.de> wrote: > Hi, > > On Wed, Feb 20, 2013 at 10:50:54AM +0100, inshu chauhan wrote: > > I have 10 simple text files with 3 columns x,y,z delimited by "space". I > am > > trying to combine these 10 files to get a single text file. > > > > Eg. of data in 10 files is > > 299 446 2 > Do you only want to concat the files, or do you want to parse/mangle > them? > > 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. > > > Can in some some way I set delimiter to NULL as the prog gives me error > if > > I do so. > Of course -- a CSV without a delimiter doesn't make any sense. > > > I dont why there is space between the attribute of first column in > > reading and there is space between every row too.. > Because there's a "split()" missing in your code. You currently tell the > CSV-writer to write the columns 2,9,9, , , ,4,4,6, , , ,2 as > space-separated CSV. So, try something like > rows = [r.split() for r in open(f, "r").readlines()] > > > Or can I merge these text files without using csv module , directly in > > python ? > If you don't need to parse/mangle the contents, you don't need the csv > module. Simple open the resulting file for writing, and then read out > the source files and write their contents into the resulting file. > > > 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 ?
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: working with csv module in python inshu chauhan <insideshoes@gmail.com> - 2013-02-20 11:38 +0100
csiph-web