Hello, I've been trying to compare two lists too see if one has substring
Let's say
AA=["Beautiful","Day"]
BB = ["Beau"]
I want to write a code that returns "Beautiful"
I find how to do that but it did not work with my gui
but my C variable did not work. When I printed the C value it is the same with my lists variable.
So I wanted to compare the "lists" and "word" to see if the "word" list has a substring in the "lists"
Thanks for your helping
Let's say
AA=["Beautiful","Day"]
BB = ["Beau"]
I want to write a code that returns "Beautiful"
I find how to do that but it did not work with my gui
keywords = [] def get(): guess = Entry.get() keywords.append(guess) # print(keywords) global label3 label3=tk.Label(lower_frame,text="İstediğiniz iletilmiştir",bg="#ECECF2") root.after(4000,label3.destroy) label3.pack() Entry.delete(0,tk.END) return keywordsthis function gets the string from my entry box
def adana_web_scraping(): source = requests.get("http://adana.gov.tr/duyurular").text soup = BeautifulSoup(source,'lxml') mydivs = soup.find('a',class_='announce-text') title = mydivs.text x=title.split(' ') lists=x[32:] word=get() word=[x.lower() for x in word] a=[] lists=[x.lower() for x in lists] str1=" " C=[x for x in lists if any(b in x for b in word)] print(C)and this function get the title of the first announcements on the website
but my C variable did not work. When I printed the C value it is the same with my lists variable.
So I wanted to compare the "lists" and "word" to see if the "word" list has a substring in the "lists"
Thanks for your helping