Hi all,
Does anyone know how to search for a string or substring within a list. I have
def searchfilt(self):
f = open("timeline1.csv", "r")
reader = csv.reader(f)
text = enterbox(msg='Please choose a highlighter search term', title='Highlighter ', default='', strip=True)
lines = []
i = -1
self.listbox2.delete(0, tk.END)
for i, line in enumerate(reader):
for words in line:
if text == words:
self.listbox2.itemconfig(i, bg='red', fg='white')
self.listbox2.insert(tk.END, line)
else:
self.listbox2.insert(tk.END, line)
This reads in every line from a csv file and checks if a string is in the line. the line is
"1280320019","u'Search Appointments at DkIT'","u'https://recruit.ancheim.ie/dkit/rec/erq_search_package.search_form?p_company=1&p_internal_external=E&p_display_in_irish=N'","Firefox History","Normal Time"
I need to for instance be able to search for ie and if its found highlight it. Im using Tkinter listbox to output the data. This has been wrecking my head.
Thanks to anyone that helps :)