I have a csv file with 4 columns that I want to use to create menus.
For example, the second column has values such as "TEST", "QA", "PROD" and a couple of others. I want to take all the values from the second column, weed out the duplicates, then create a menu allowing the users to select all the records with, say, QA in the second column. How is the best way to go about this? (Later I want the user to be able to pick values from more than one column to pick selected records with)
Please keep in mind that I am very new to Python. I can do this in BASH with select/case construct but can not find how to do it in Python.
Jump to Post
Here is one approach.
Assuming the data file is not very big, you can read the whole thing into memory and manipulate it from there. Otherwise, you may want to read just the second column from the csv file to produce the menu.
import csv data = …
All 6 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.