Python Forum
List Comparing problem with GUI
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
List Comparing problem with GUI
#1
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
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 keywords
this 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
Reply


Messages In This Thread
List Comparing problem with GUI - by ardvci - Sep-23-2020, 06:42 PM
RE: List Comparing problem with GUI - by Larz60+ - Sep-23-2020, 09:54 PM
RE: List Comparing problem with GUI - by ardvci - Sep-24-2020, 08:52 AM
RE: List Comparing problem with GUI - by Larz60+ - Sep-24-2020, 07:33 PM
RE: List Comparing problem with GUI - by ardvci - Sep-24-2020, 08:10 PM
RE: List Comparing problem with GUI - by Larz60+ - Sep-25-2020, 03:47 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020