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

Ian Kelly ian.g.kelly at gmail.com
Tue Apr 26 12:13:38 EDT 2016


On Tue, Apr 26, 2016 at 10:01 AM,  <peakgraphicz at 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.



More information about the Python-list mailing list