0
我只是不明白爲什麼這不工作... 請幫助谷歌App Engine的蟒蛇循環不工作
在我的數據庫我有一個分配類 每個任務都有一個名稱屬性和標籤物業
基本上我試圖讓該看到一個搜索結果,如果搜索詞(一子)是在數據存儲
#Here I pull out all of the Assignments from the assignment class
res = db.GqlQuery("SELECT * FROM Assignment ORDER BY created DESC")
#Here I make a results list, to store the finished assignments in
results = []
#This is a loop to go through all terms of the search
for t in terms:
#Here is a loop to go through all assignments per search term
for r in res:
#Here is why in the world does this not work...
#If I change it to "if 'd' in 'dog' and t not in results:",
#then it works....
#but even when t is 'a' and r.name is 'aaa' it doesn't work
if t in r.name and t not in results:
results.append(r)
if r.tags:
if t in r.tags and t not in results:
results.append(r)
print results