I'm trying to make a simple gui with tkinter utilizing windows built-in search functionality. This is the code I'm having issues with.
#gets search keywords from user input and splits into list
keyword_list = self.entry.get()
keyword_list = keyword_list.split()
#creates empty string
keyword_string = ""
#fills empty string with list, appends necessary quotation marks
for i in keyword_list:
keyword_string += "\"" + i + "\""
print(keyword_string)
#runs cmd query of windows index
subprocess.call("c:/users/jdoe/desktop/wssql.exe " +
"\"select system.ItemPathDisplay from systemindex
where contains(*,'" +
keyword_string +
"')\"")
With that code, if I enter two keywords into the input field, say "test1" and "test2", python will print keyword_string as this:
"test1""test2"
but, when keyword_string is used in the query it shows up as this:
test1test2
So, somewhere after the print command, Python is stripping the quotation marks from the strings?
Have you tried using two sets of quotation marks? Or a set of single quotation marks inside of a set of double quotation mark?