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

2016-05-02 Thread Ian Kelly
On Mon, May 2, 2016 at 3:52 AM, Adam Davis wrote: > Hi Ian, > > I'm really struggling to implement a set into my code as I'm a beginner, > it's taking me a while to grasp the idea of it. If I was to show you my code > so you get an idea of my aim/function of the code, would you be able to help > m

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

2016-04-27 Thread darnold via Python-list
potential_passengers = ['bob','john','sue','wendy','chris','bob','jen','wendy'] accepted_passengers = set() for name in potential_passengers: print('checking on {}...'.format(name)) if name not in accepted_passengers: accepted_passengers.add(name) print('welcome aboard, {}

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

2016-04-27 Thread Andrew Ongko
On Apr 27, 2016 7:25 PM, "Adam Davis" 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 wrote: > > > I understand what you're saying! But where you say: " the_set = set()", what would go within the set brackets? > > > > N

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

2016-04-27 Thread Adam Davis
On Wednesday, 27 April 2016 07:37:42 UTC+1, Chris Angelico wrote: > On Wed, Apr 27, 2016 at 4:26 PM, Adam Davis 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 n

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

2016-04-26 Thread Chris Angelico
On Wed, Apr 27, 2016 at 4:26 PM, Adam Davis 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 a

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

2016-04-26 Thread Adam Davis
On Tuesday, 26 April 2016 21:23:58 UTC+1, MRAB wrote: > On 2016-04-26 21:07, Adam Davis wrote: > > On Tuesday, 26 April 2016 20:52:54 UTC+1, Ian wrote: > >> On Tue, Apr 26, 2016 at 1:05 PM, Joaquin Alzola > >> wrote: > >> > Just an example. Didn't use the csv but just hope that it helps. > >> >

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

2016-04-26 Thread Joaquin Alzola
import csv Use dictionary {key:value} -Original Message- From: Python-list [mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf Of peakgraph...@gmail.com Sent: 26 April 2016 17:01 To: python-list@python.org Subject: Howw to prevent the duplication of any value in

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

2016-04-26 Thread MRAB
On 2016-04-26 21:07, Adam Davis wrote: On Tuesday, 26 April 2016 20:52:54 UTC+1, Ian wrote: On Tue, Apr 26, 2016 at 1:05 PM, Joaquin Alzola 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

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

2016-04-26 Thread Ian Kelly
On Tue, Apr 26, 2016 at 2:07 PM, Adam Davis wrote: > On Tuesday, 26 April 2016 20:52:54 UTC+1, Ian wrote: >> On Tue, Apr 26, 2016 at 1:05 PM, Joaquin Alzola >> wrote: >> > Just an example. Didn't use the csv but just hope that it helps. >> > >> > name=[] >> > name_exist="Dop" >> > >> > with open

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

2016-04-26 Thread Adam Davis
On Tuesday, 26 April 2016 20:52:54 UTC+1, Ian wrote: > On Tue, Apr 26, 2016 at 1:05 PM, Joaquin Alzola > 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: > >

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

2016-04-26 Thread Ian Kelly
On Tue, Apr 26, 2016 at 1:05 PM, Joaquin Alzola 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])

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

2016-04-26 Thread Ian Kelly
On Tue, Apr 26, 2016 at 11:00 AM, Adam Davis wrote: > On Tuesday, 26 April 2016 17:14:36 UTC+1, Ian wrote: >> On Tue, Apr 26, 2016 at 10:01 AM, 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 cr

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

2016-04-26 Thread Joaquin Alzola
hon-list [mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf Of Adam Davis Sent: 26 April 2016 18:05 To: python-list@python.org Subject: Re: Howw to prevent the duplication of any value in a column within a CSV file (python) On Tuesday, 26 April 2016 17:01:41 UTC+1, Adam

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

2016-04-26 Thread Adam Davis
On Tuesday, 26 April 2016 17:01:41 UTC+1, Adam Davis 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

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

2016-04-26 Thread Adam Davis
On Tuesday, 26 April 2016 17:09:10 UTC+1, Joel Goldstick wrote: > On Tue, Apr 26, 2016 at 12:01 PM, 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 in

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

2016-04-26 Thread Adam Davis
On Tuesday, 26 April 2016 17:14:36 UTC+1, Ian wrote: > On Tue, Apr 26, 2016 at 10:01 AM, 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

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

2016-04-26 Thread Ian Kelly
On Tue, Apr 26, 2016 at 10:01 AM, 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 t

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

2016-04-26 Thread Joel Goldstick
On Tue, Apr 26, 2016 at 12:01 PM, 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 t

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

2016-04-26 Thread peakgraphicz
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 thi