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


Groups > comp.lang.python > #107684

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 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:50:20 -0600
Lines 21
Message-ID <mailman.126.1461700262.32212.python-list@python.org> (permalink)
References <75e5d8dc-e15b-4350-95e8-490abd4aa14f@googlegroups.com> <CALwzidm6yaZKzMLmwvKzFyQ7rvhASp3vPmDA-CYG=iS9YokFuA@mail.gmail.com> <mailman.113.1461687261.32212.python-list@python.org> <514e507d-42de-400e-b999-14605c4456e8@googlegroups.com> <CALwzidkHwpnNgtLR78tgbeurh-aRLMaVqjJ6GWFfXDQMBk84mg@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de CRb2CLXJ6YikRV3urfM47gD7CNEssw9cC1UdHP2ZTnNg==
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.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'received:209.85.223': 0.03; 'value,': 0.03; 'column': 0.07; 'subject:file': 0.07; 'csv': 0.09; 'subject:CSV': 0.09; 'python.': 0.11; 'subject:python': 0.14; 'do,': 0.15; 'subject: \n ': 0.15; 'value.': 0.15; '2016': 0.16; 'adam': 0.16; 'forbid': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'assuming': 0.22; 'am,': 0.23; 'fit': 0.23; 'header:In-Reply- To:1': 0.24; 'wondering': 0.25; 'entered': 0.27; 'message- id:@mail.gmail.com': 0.27; 'have,': 0.27; 'function': 0.28; 'values': 0.28; "i'm": 0.30; 'code': 0.30; 'tue,': 0.34; 'file': 0.34; 'received:google.com': 0.35; 'set.': 0.35; 'created': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'names': 0.38; 'does': 0.39; 'subject:the': 0.39; 'enough': 0.39; 'to:addr:python.org': 0.40; '26,': 0.72; 'column.': 0.84; '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 :content-transfer-encoding; bh=e7K4JRib6kurI0A/liGMotw1E/cpCp3E3lS6KobDs78=; b=IOi2Ch2pEKNxq7M6MIpLAu42WufF8yjpji/4Fl6wRFQyy275ogrK5wPaAmOjFg1gcM AQazli4Flct1ip/A4B1xPuMaYBfTbtZqwPl5MHJPP2ZF00siH4b4nqqaKzVGbSHVYUQz d9WfXPmXGzg0TzJHWhH9o6K8Ik6dgPSJUSHzVMAc/fi0tMP4pEXGRAdCN1ULpw1gB18I xQEY9lW389h/pg61JQfRQIkVhDV5KSUgdqeN09iEdEtvJH9hRr1AHwouBWvtdbaYW6PD H7uSC9wMpmog43Z5bJcILxfRdSHyeJrAOMpw5q5jXVusJf5DSkSxJG2KEmGD78Z8eQXz ruHg==
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:content-transfer-encoding; bh=e7K4JRib6kurI0A/liGMotw1E/cpCp3E3lS6KobDs78=; b=m7CXEhdwbtMvoss042MunFvwpc++MJCCx2EK1v6KXzx24XaNPJir9wddlNtbrcdl7h DVRcPEXmiCac5KFKCanTRM4OiD1PNuUiKP6KilDlgp9ANCib6aJbFukIlCYpkcLmEBSe 3WiHcgs6FWttnPXljoB3BAGdEWxdOeZ5fJ4rMI271cFw+B9PBqFQWMuPhiphlHf0kg1A AXrrOAyXRGWFoI6en4iOiAhjDPRx+iupXkfbZjrfmX/YI5JD/avA4k7IcSpYfyLqH4sv sXjIJSq73+qgwWuW3yCIM8j8ytGra4yd6oTu8ZTFzbx4NyY0BZ6dEtLBmtrYbyjmpmaZ iHqw==
X-Gm-Message-State AOPr4FW78CZ8PPSB/I1Go9aQNoG48n4H/aCEQsz4JOGbo2RFycitpCzShPV2LU/zqeNHtPOC/rPZee3K3Dgc4g==
X-Received by 10.107.171.198 with SMTP id u189mr5811119ioe.111.1461700259708; Tue, 26 Apr 2016 12:50:59 -0700 (PDT)
In-Reply-To <514e507d-42de-400e-b999-14605c4456e8@googlegroups.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 <CALwzidkHwpnNgtLR78tgbeurh-aRLMaVqjJ6GWFfXDQMBk84mg@mail.gmail.com>
X-Mailman-Original-References <75e5d8dc-e15b-4350-95e8-490abd4aa14f@googlegroups.com> <CALwzidm6yaZKzMLmwvKzFyQ7rvhASp3vPmDA-CYG=iS9YokFuA@mail.gmail.com> <mailman.113.1461687261.32212.python-list@python.org> <514e507d-42de-400e-b999-14605c4456e8@googlegroups.com>
Xref csiph.com comp.lang.python:107684

Show key headers only | View raw


On Tue, Apr 26, 2016 at 11:00 AM, Adam Davis <peakgraphicz@gmail.com> wrote:
> On Tuesday, 26 April 2016 17:14:36 UTC+1, Ian  wrote:
>> On Tue, Apr 26, 2016 at 10:01 AM,  <peakgraphicz@gmail.com> wrote:
>> > I am wondering how to make my code function so it does not allow any of the same values to be entered into a column in my CSV file created through python. So I need to read into the CSV file and check if any names have already been entered. If they have, the user must not be allowed to enter this value.
>>
>> Assuming the file is reasonably small enough to fit into memory,
>> create a set and populate it with the values in the column. When the
>> user enters a new value, check whether it's already in the set.
>
> That's exactly what I want to do, however, I'm unsure how to check whether it's in the set?

if value in the_set:
    # Forbid the value.
else:
    # Allow the value.

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