I am trying to control for many variables in an object. To do so I am looking to see if certain words exist in the object:
jobs = csv.DictReader(open("jobsFile.csv", "rb"))
jobsWithRoles = []
for i in jobs:
if "Clerk" or "Stock" or "Sales" in jobs['Roles']:
i["RoleNum"] = 1
jobsWithRoles.append(i)
elif "Janitor" or "President" or "Driver" in jobs["Roles"]:
i["RoleNum"] = 2
jobsWithRoles.append(i)
else:
i["RoleNum"] = 5
jobsWithRoles.append(i)
The problem is that everything is getting assigned "1" regardless if they strings exist or not.