Python: search XPath using a list of file

I am trying to use a list or a .txt file to search for text/string in a span. So far I am able to find one string but not incorporate any others without messy code. I want to look for Hi, Hey, Hello, etc

browser.find_element_by_xpath('//span[text()= "Hey"]')

The text file will be:


Edit: Would a contain be easier to use in this case?


If we have a list like this

text_list = ['Hi', 'Hey', 'Hello']

You can parse in the Selenium driver.find_elememt like below

browser.find_element_by_xpath(f'//span[text()= "{text_list[0]}"]')

Here I am parsing [0] which will be the first element, you can change the index as you wish to.