Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #107723

Re: Howw to prevent the duplication of any value in a column within a CSV file (python)

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Andrew Ongko <andrew.ongko@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 Wed, 27 Apr 2016 19:57:58 +0700
Lines 34
Message-ID <mailman.147.1461761880.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> <mailman.127.1461700361.32212.python-list@python.org> <49f4ffd8-d140-4f1b-95a9-75cb122e8b2f@googlegroups.com> <e442a9aa-60f2-641f-08fe-487ca1d29799@mrabarnett.plus.com> <mailman.129.1461702225.32212.python-list@python.org> <f8a42577-e3c7-4dd6-a2a7-9cee58c37ee4@googlegroups.com> <CAPTjJmqhoJrE5mHHdCSwj-aORx7YTVTuJgdNwZ9T7mq3QxFrvA@mail.gmail.com> <mailman.143.1461739050.32212.python-list@python.org> <75d2b984-0a1e-42fa-bb3d-f698d4f5e0a1@googlegroups.com> <CACfV+Gxvma-6vvqqxXtSL0uv7P9uhJaiXF+t-yXq-TSdLHCTUA@mail.gmail.com> <CACfV+Gxrqgk+Z9CobZ38vvDuAh=THhdfsganOht+Sj4vfRkgHw@mail.gmail.com> <CACfV+GwKbNx4r=3xybisiwtqHSJtFEnz5Kzh8a+MXfecYAYgHg@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de UerSTQIdMdpTeIrQOUKmTAY3evUVS+j19irRI99yS9Gg==
Return-Path <andrew.ongko@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; 'constructor': 0.07; 'subject:file': 0.07; 'wednesday,': 0.07; 'cc:addr:python-list': 0.09; 'subject:CSV': 0.09; 'subject:python': 0.14; 'wed,': 0.15; 'subject: \n ': 0.15; '2016': 0.16; 'adam': 0.16; 'csv,': 0.16; 'forbid': 0.16; 'parentheses': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'case.': 0.18; 'pfxlen:0': 0.18; '&gt;': 0.18; 'email addr:gmail.com&gt;': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'cc:no real name:2**0': 0.22; 'header :In-Reply-To:1': 0.24; 'chris': 0.26; 'not.': 0.27; 'message- id:@mail.gmail.com': 0.27; 'andrew': 0.27; '&quot;': 0.29; 'says': 0.32; "skip:' 20": 0.34; 'that,': 0.34; 'received:google.com': 0.35; 'nothing.': 0.35; 'set.': 0.35; 'item': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'received:209': 0.38; 'mean': 0.38; 'subject:the': 0.39; 'where': 0.40; 'care': 0.60; 'your': 0.60; 'back': 0.62; 'within': 0.64; '4:26': 0.84; '7:25': 0.84; 'chrisa': 0.84; 'subject:any': 0.84; 'subject:value': 0.84; 'do:': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=U8S/VsiZ32eELMqFE1IkD2nKJZAx6Hhzgm54j1T+P8o=; b=KGHEA3+UwaG665Auc+cRTKQ/Kd/pLs85iMETW+D55D13eKLnuvQvIbd/P669Gp3IjV lmmF383020YrJYUwBy2giGs1hy863sUFt5JpY0A4/jlpvTlZnE5RuK6h1yYRHV3l9Cqd HTrfrZBZv2mY/LBzS7JMTSyZZ5FYMX2UontkrTiuFikWUo6XhudpLblyTnJpkzgnOPOk +NzbsR8keLj5NdFVF+HP4bIeBH7gIfOa+Shq9bdXIsElf+flG7qtqmeb295Yq3aSkmLf /rBQJ3IPDrlBjoSuhLU0u53jtVDocyIF3DT3jAhEpcfx1xg9jhtJ+wPh7p18cVl7d2Rq g7Mg==
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:date :message-id:subject:from:to:cc; bh=U8S/VsiZ32eELMqFE1IkD2nKJZAx6Hhzgm54j1T+P8o=; b=iiyrcOjnmq8m8XOCpS2GoCebV1B0urZjSIMsHqDt9gfiNnz4fXM1n5/ski9k+q82rO 6qn3L/TjKS2/ClqLpod8TRqcSkd9rh4PW3PJn9LqtEvO9rbCZmkOyL2uZ0y6dCBb/19M nv1tWy6lEuHDekaV3ViJv7gQNQE5xq+d1npJdFAgKtjI7NmFWy4kcCIgOCDtS7cLbIZB ez2LRyujv2donMLKcLDvXkyv/bGj/cZSSMw6PTZYq9zYFklEZpXgjUg4cUtN2yLUNlPj vQglmEk/RCr60bY4Cvp6ett8ZGlMO9mTa2EnmrwmSyOTQQBHQgFa2AKPo3w2jeFjHyXU M9qg==
X-Gm-Message-State AOPr4FUGbc+St7K4ITwrOcQsp5G1T8MhvKn0RULVeiLe25+/086bGj7MZ7nICDuhXUU9LAzW2GXoGKRLUzfaUA==
X-Received by 10.37.97.73 with SMTP id v70mr4698970ybb.39.1461761879100; Wed, 27 Apr 2016 05:57:59 -0700 (PDT)
In-Reply-To <CACfV+Gxrqgk+Z9CobZ38vvDuAh=THhdfsganOht+Sj4vfRkgHw@mail.gmail.com>
X-Content-Filtered-By Mailman/MimeDel 2.1.22
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 <CACfV+GwKbNx4r=3xybisiwtqHSJtFEnz5Kzh8a+MXfecYAYgHg@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> <CALwzidn=KRgvWZq9jc+G5hT6dxDOOjkYZLTbjLR6qNh82m2_LA@mail.gmail.com> <mailman.127.1461700361.32212.python-list@python.org> <49f4ffd8-d140-4f1b-95a9-75cb122e8b2f@googlegroups.com> <e442a9aa-60f2-641f-08fe-487ca1d29799@mrabarnett.plus.com> <mailman.129.1461702225.32212.python-list@python.org> <f8a42577-e3c7-4dd6-a2a7-9cee58c37ee4@googlegroups.com> <CAPTjJmqhoJrE5mHHdCSwj-aORx7YTVTuJgdNwZ9T7mq3QxFrvA@mail.gmail.com> <mailman.143.1461739050.32212.python-list@python.org> <75d2b984-0a1e-42fa-bb3d-f698d4f5e0a1@googlegroups.com> <CACfV+Gxvma-6vvqqxXtSL0uv7P9uhJaiXF+t-yXq-TSdLHCTUA@mail.gmail.com> <CACfV+Gxrqgk+Z9CobZ38vvDuAh=THhdfsganOht+Sj4vfRkgHw@mail.gmail.com>
Xref csiph.com comp.lang.python:107723

Show key headers only | View raw


On Apr 27, 2016 7:25 PM, "Adam Davis" <peakgraphicz@gmail.com> wrote:
>
> On Wednesday, 27 April 2016 07:37:42 UTC+1, Chris Angelico  wrote:
> > On Wed, Apr 27, 2016 at 4:26 PM, Adam Davis <peakgraphicz@gmail.com>
wrote:
> > > I understand what you're saying! But where you say: " the_set =
set()", what would go within the set brackets?
> >
> > Nothing. The empty parentheses mean "call this with no arguments", and
> > when you call the set constructor like that, you get back an empty
> > set.
> >
> > ChrisA
>
> Thanks Chris. Where Ian says 'the_set.add(item)', what would be put
within item in terms of my codes function/aim?

item is name in your case. Since it's the one you care about existing or
not.

It would be like:
Read from csv,
For each row, the_set.add(name)

Now that you have the_set in memory, whenever you want to check whether a
particular name has taken the quiz, just do:

if name in the_set:
    # forbid
else:
    # allow

Regards,
Andrew

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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