I have a variable that contains a string of:
fruit_wanted = 'banana,apple'
I also have a csv file
fruit,'orange','grape','banana','mango','apple','strawberry'
number,1,2,3,4,5,6
value,3,2,2,4,2,1
price,3,2,1,2,3,4
Now how do I delete the column in which the 'fruit' does not listed in the 'fruit_wanted' variable?
So that the outfile would look like
fruit,'banana','apple'
number,3,5
value,2,2
price,1,3
Thank you.