I am trying this below.
my_list = []
for row in reader:
a = row[0]
b = row[1]
c = row[2]
s=("{0:<5s} {1:<5s} {2:<8s} ".format(a,b,c))
lst = my_list.append(s)
if b == ("Home"):
n_lst = new_lst.appen(s)
I want if row b in my output equals “home” “gone” etc to put that line in a new list. I tried
if b == ("home", "gone"):
but that doesn’t work, is there a way to keep adding things to my if == statement instead of doing a bunch of elif statements?
Use the
inkeyword instead:This checks to see if
bis an element of that list.Also, you seem to have a spelling mistake here: