Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39348
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <davea@davea.name> |
| 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; 'attribute': 0.05; 'skip:o 50': 0.07; '"w")': 0.09; 'read()': 0.09; 'subject:module': 0.09; 'stored': 0.10; 'subject:python': 0.11; 'f.read()': 0.16; 'naming': 0.16; 'wrote:': 0.17; 'skip:g 40': 0.17; 'string,': 0.17; 'skip:" 40': 0.20; 'file.': 0.20; 'trying': 0.21; 'import': 0.21; 'tried': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; '(most': 0.27; 'am,': 0.27; 'forgot': 0.27; 'folder': 0.30; 'error': 0.30; 'code': 0.31; 'file': 0.32; 'print': 0.32; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'open': 0.35; 'but': 0.36; 'subject:with': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'here': 0.65; 'obvious': 0.71; 'received:74.208': 0.71; 'received:74.208.4.194': 0.84 |
| Date | Wed, 20 Feb 2013 06:22:48 -0500 |
| From | Dave Angel <davea@davea.name> |
| 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 | <CAFqGZRG3wVyf6jMBESjr6bmnLhLsT-_BG0xSH_rcpe4Oqb+1nQ@mail.gmail.com> <20130220102601.GD22457@localhost> <CAFqGZRG3RwgdSjDs1xRpv0YdEV0yXxeFJCefhP+w_6DEdwrwPQ@mail.gmail.com> <CAFqGZRGAw95bXdZt5_9KTyD5VSEYRwM=JqKWUVmP+qSnW-PqpQ@mail.gmail.com> |
| In-Reply-To | <CAFqGZRGAw95bXdZt5_9KTyD5VSEYRwM=JqKWUVmP+qSnW-PqpQ@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:Owrwnyu+LA4nK0Ny0A+BbLfOrBdqJWZlxblatsYSqxD Drn3lvQbnc9oJzTDwxJv0/nKL1zyeBjLl2Y20T/VJErLon++m1 MmuVtg953bBIDRBOvjixEDdsnSGwAyayF8Jxr4Zd25xBWyeT/W yLPUSsAJhB+WnK2aVV359Edyit5/s2OiETbEtPtzhHPpqJpLUq Mry4OwWfn6uExowMhnj0TGwSgCj3SLUjoVQJJvqjd2brs8l8fQ FSP6kFioOVnIWJHKy/kTOB+pLdCQEspCySYim0yBBMbg6iaY9d YxyH2Bd4R18Z1G9gnaTcLQhUjzszAL369vJbQaaB2QhpEyDEQ= = |
| 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.2107.1361359386.2939.python-list@python.org> (permalink) |
| Lines | 38 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1361359386 news.xs4all.nl 6943 [2001:888:2000:d::a6]:35436 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:39348 |
Show key headers only | View raw
On 02/20/2013 06:01 AM, inshu chauhan wrote: > > <snip> >> >> For simple concating the files , I tried the following code : > > import glob > > with open(r"C:\Users\inshu.chauhan\Desktop\test2.arff", "w") as w: > print w > for f in glob.glob(r"C:\Users\inshu.chauhan\Desktop\For > Model_600\*.arff"): You forgot to open file f. f is a string, naming a single file. > g = f.read() > w.write(g) > > > But I think I am having an obvious error : > > <open file 'C:\Users\inshu.chauhan\Desktop\test2.arff', mode 'w' at > 0x01B64F40> > > Traceback (most recent call last): > File "C:\Users\inshu.chauhan\Desktop\Concatfiles.py", line 6, in <module> > g = f.read() > AttributeError: 'str' object has no attribute 'read' > > Here I am trying to refer the files stored in my folder by 'f', Why read() > is not working ? > > > -- DaveA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: working with csv module in python Dave Angel <davea@davea.name> - 2013-02-20 06:22 -0500
csiph-web