Consider the following list:
items = ['about-conference','conf']
Iterating over the list using the following for loop prints “about-conference” and “conf”
for word in items:
if 'conf' in word:
print word
How do I get the if statement to only prove true if it encounters an exact match i.e printing “conf” only?
Thank you.
Don’t use
in, use==to test for exact equality: