Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107685
| Path | csiph.com!feeder.erje.net!2.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Howw to prevent the duplication of any value in a column within a CSV file (python) |
| Date | Tue, 26 Apr 2016 13:51:58 -0600 |
| Lines | 21 |
| Message-ID | <mailman.127.1461700361.32212.python-list@python.org> (permalink) |
| References | <75e5d8dc-e15b-4350-95e8-490abd4aa14f@googlegroups.com> <531e2dda-c522-4b11-a030-f3f37078f344@googlegroups.com> <HE1PR07MB13561533B5D2DEE4B31F9AA9F0630@HE1PR07MB1356.eurprd07.prod.outlook.com> <CALwzidn=KRgvWZq9jc+G5hT6dxDOOjkYZLTbjLR6qNh82m2_LA@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de njhszb+chH4PK4sIHDqxZgZv4Bh9e0uKWkPfU5MXdPfQ== |
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'else:': 0.03; 'subject:file': 0.07; 'csv': 0.09; 'subject:CSV': 0.09; 'thread': 0.10; 'subject:python': 0.14; 'subject: \n ': 0.15; '2016': 0.16; 'file.close()': 0.16; 'found"': 0.16; 'helps.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'example.': 0.18; 'noted': 0.22; 'header:In-Reply-To:1': 0.24; 'checking': 0.27; 'message-id:@mail.gmail.com': 0.27; '"no': 0.29; 'print': 0.30; 'tue,': 0.34; 'file': 0.34; 'except': 0.34; 'membership': 0.34; 'received:google.com': 0.35; 'set.': 0.35; 'but': 0.36; 'list,': 0.36; 'received:209.85': 0.36; 'faster': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'subject:the': 0.39; "didn't": 0.39; 'to:addr:python.org': 0.40; 'hope': 0.61; 'skip:n 10': 0.62; 'elsewhere': 0.66; '26,': 0.72; 'subject:any': 0.84; 'subject:value': 0.84; 'to:name:python': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=Zjdlqbi063CgDktInwPRTIoMz4vRLqeunoy+5Rl1Rm0=; b=O19oV70ArJ5ZiGa8UUx6Czuxh1fturSzr1mMMAvEPOSfYsKhS4pZS9+JDqCnbN7LRe eZjRO+jvUYm0WWoviG02f1trwjRi0pNFBGpegSj4ecEq+DnIixVPtYaJ6CqczouM/tIV sdGITZwJ7PFLAM87SO+jtxjxZc0NiomEbxt1+lNneAwS9HYUNv/L7LaJfxkCIliYvZKd W8eGCr0kEBmhNVo+eGavkxChJSGn5b89hmFUr/J9zCvrdZ3ZY7smu9KuqB46I6gmhAOH 86SEl2GIgwtbjBjBWAeWDZyt6HCcZa+50wHvgXiMqdfMbtqJJh1m/hA0vDD1vpIcyKos ITHg== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=Zjdlqbi063CgDktInwPRTIoMz4vRLqeunoy+5Rl1Rm0=; b=ilQz/ftFUEbkovNBHOgvgO6x0wMVo7tg1HRQ1DnBKJGqzI9B+oRtgeJnPC6u4Zg4cA U5Em0NP1GezGv3go6tojhNEdXUkfgzpi/VSacuzzBfBWZxybzGLi0UuSQgUbjtgu5e6I f1CT2Son/Vwbiza/khrnJzoNqIm1gPU3tTdu3zTe8XD98TYYz/pvZzOIqnngqZg84d7e esyUrGYwl5ayLB94ACRyjdiTTRX07U8EqbiMU49szJTbiawKF2wZd/onVIQiXwzdqwiq ycDerIAaM0iaATvlvC564zOm4EADe6zPsdb7cm4e8x1yneXxUuM757/OmqGRi8K9RtYk PBEg== |
| X-Gm-Message-State | AOPr4FWacnrJH3D0K12MdXHJE2OCc12GDvnYf0ryl+0RQOuYcqitFvUN+i6C+FjqufAq5RhUsAnbc0CXai6gHA== |
| X-Received | by 10.50.13.73 with SMTP id f9mr5818442igc.68.1461700357732; Tue, 26 Apr 2016 12:52:37 -0700 (PDT) |
| In-Reply-To | <HE1PR07MB13561533B5D2DEE4B31F9AA9F0630@HE1PR07MB1356.eurprd07.prod.outlook.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <CALwzidn=KRgvWZq9jc+G5hT6dxDOOjkYZLTbjLR6qNh82m2_LA@mail.gmail.com> |
| X-Mailman-Original-References | <75e5d8dc-e15b-4350-95e8-490abd4aa14f@googlegroups.com> <531e2dda-c522-4b11-a030-f3f37078f344@googlegroups.com> <HE1PR07MB13561533B5D2DEE4B31F9AA9F0630@HE1PR07MB1356.eurprd07.prod.outlook.com> |
| Xref | csiph.com comp.lang.python:107685 |
Show key headers only | View raw
On Tue, Apr 26, 2016 at 1:05 PM, Joaquin Alzola
<Joaquin.Alzola@lebara.com> wrote:
> Just an example. Didn't use the csv but just hope that it helps.
>
> name=[]
> name_exist="Dop"
>
> with open("dop.csv") as f:
> for line in f:
> line_split=line.split(',')
> name.append(line_strip[0])
> if name_exist in name:
> print "found name " + name_exist + " Can not append"
> else:
> file = open("dop.csv",'a')
> print "No name found"
> file.write(name_exist)
> file.close()
Except that as noted elsewhere in the thread a set would be a better
choice than a list, since checking membership is much faster on a set.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Howw to prevent the duplication of any value in a column within a CSV file (python) peakgraphicz@gmail.com - 2016-04-26 09:01 -0700
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) Joel Goldstick <joel.goldstick@gmail.com> - 2016-04-26 12:08 -0400
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) Adam Davis <peakgraphicz@gmail.com> - 2016-04-26 10:05 -0700
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-04-26 20:10 -0400
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) Ian Kelly <ian.g.kelly@gmail.com> - 2016-04-26 10:13 -0600
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) Adam Davis <peakgraphicz@gmail.com> - 2016-04-26 10:00 -0700
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) Ian Kelly <ian.g.kelly@gmail.com> - 2016-04-26 13:50 -0600
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) Adam Davis <peakgraphicz@gmail.com> - 2016-04-26 10:05 -0700
RE: Howw to prevent the duplication of any value in a column within a CSV file (python) Joaquin Alzola <Joaquin.Alzola@lebara.com> - 2016-04-26 19:05 +0000
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) Ian Kelly <ian.g.kelly@gmail.com> - 2016-04-26 13:51 -0600
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) Adam Davis <peakgraphicz@gmail.com> - 2016-04-26 13:07 -0700
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) Ian Kelly <ian.g.kelly@gmail.com> - 2016-04-26 14:19 -0600
Re: Private message regarding: Howw to prevent the duplication of any value in a column within a CSV file (python) Ian Kelly <ian.g.kelly@gmail.com> - 2016-05-02 07:47 -0600
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) MRAB <python@mrabarnett.plus.com> - 2016-04-26 21:23 +0100
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) Adam Davis <peakgraphicz@gmail.com> - 2016-04-26 23:26 -0700
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) Chris Angelico <rosuav@gmail.com> - 2016-04-27 16:37 +1000
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) Adam Davis <peakgraphicz@gmail.com> - 2016-04-27 05:23 -0700
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) Andrew Ongko <andrew.ongko@gmail.com> - 2016-04-27 19:57 +0700
Re: Howw to prevent the duplication of any value in a column within a CSV file (python) darnold <darnold992000@yahoo.com> - 2016-04-27 08:49 -0700
RE: Howw to prevent the duplication of any value in a column within a CSV file (python) Joaquin Alzola <Joaquin.Alzola@lebara.com> - 2016-04-26 16:07 +0000
csiph-web