There is such a code.
name_elem_site = text_element_by_class_name(driver, "texttexttext") currentList = [] currentWord = currentList.append(str(name_elem_site)) if name_elem_site: for word in currentList: if word == currentWord: continue currentWord = word currentList.append(word) log.write("%s\n" % word) log.flush() Objective: to obtain data by word and write to the list, without recording a row of running data. Those. should be so
Word1, Word2, Word1, Word3, Word2, Word3, Word2, .., WordN
And I get
Word1, Word1, Word1, Word2, Word2, Word2, Word3, .., WordN
Tried to add if currentList[-1] != word
But the result is the same ...
name_elem_site = text_element_by_class_name(driver, "texttexttext") currentList = [] currentWord = currentList.append(str(name_elem_site)) if name_elem_site: for word in currentList: if word == currentWord: continue currentWord = word if currentList[-1] != word: # ะฟะพัะปะตะดะฝะธะน ัะปะตะผะตะฝั ะฝะต ัะฐะฒะตะฝ ัะตะบััะตะผั currentList.append(word) log.write("%s\n" % word) log.flush() How to proceed? Beginner, I can not guess.