def init(): for ques in allQues: zh = ques.getTitle() ques.setTips(zh) pin = lazy_pinyin(zh) spell = "" for i in pin: spell = spell + i[0] #加上首字母 ques.setSpell(spell) # print(len(allQues)) # print(allQues[0].getNum()) # print(allQues[0].getSpell()) for ques in allQues: Trie.addTrieOne(ques.getNum(), ques.getSpell())