I am trying to write a python code that will read a csv file and then accept user inputs to determine which data from the csv file matches, then write to another csv file. So far I have been stumped on how to accept multiple user inputs and have created the following code to take them then print the data that matches.
with open("Project4Inventory.csv", 'r') as filename:
contents=filename.readlines()
inputFile = input("PRINT INPUT HERE")
inputList = inputFile.split(" ", 3)
for contentsArray in range(1, 5):
if len(inputList) == 1:
if inputList[0] in contents[contentsArray]:
print(contents[contentsArray])
elif len(inputList) == 2:
if inputList[0] in contents[contentsArray] or inputList[1] in contents[contentsArray]:
print(contents[contentsArray])
elif len(inputList) == 3:
if inputList[0] in contents[contentsArray] or inputList[1] in contents[contentsArray] or inputList[2] in contents[contentsArray]:
print(contents[contentsArray])