I'm trying to create a checklist program for my sports cards. I would like to design a function that looks up the cardnumber I entered and inserts an x into the have column before the number if there already isn't an x there. I've added the csv example and relevant code below
Have,Card
,1 Will Harridge
,2 Warren Giles
,3 Elmer Valo - Kansas City Athletics
,4 Carlos Paula - Washington Senators
,5 Ted Williams - Boston Red Sox
,6 Ray Boone - Detroit Tigers
import csv
def addcard(card):
for i in CardData:
Cardlist = open('1956topps.csv')
CardListReader = csv.reader(Cardlist)
CardData = csv.writer(CardListReader)
while True:
Option = int(input(" Choose your option: '\n' 1. Add a card to the collection '\n' "
"2. Delete a card form the collection '\n' 3. Print a list of cards you need '\n' "
"4. Print a list of cards you have '\n' 5. Look up individual card info '\n' 6. Quit'\n'"))
if Option == 1:
card = input('Enter the card number you want to add \n')
addcard(card)