D
D
Dmitry2020-05-08 12:23:42
Python
Dmitry, 2020-05-08 12:23:42

Python how to find exact match of an element in a list?

Hello, right away - I'm not a real programmer), but it took me to fix one script here and something I'm a little stumped.
There is a sheet. All variables are strictly textual, in one word without spaces. Example
one , two, three, four, five, fivefive

there is a check in the script

if word in wordList 
  do something

and I have a problem, I need to know exactly the presence of the five variable, but if it is not there, then the script still does not work, fivefive interferes. How to check the exact occurrence of an element in a list?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zexer, 2020-05-08
@q2digger

for word in wordList:
    if word == someWord:
        do something

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question