2011-10-05 43 views

回答

0

如果你的話是Unicode字符串,在列表中words收集,然後將下面的代碼片段顯示了所有單詞,"x"

for word in words: 
    if word.startswith(u"x"): 
     print word 

開始或者,如果你想要得到的開始u"x"所有單詞的列表,你可以使用列表理解:

selected_words = [ w for w in words if w.startswith(u"x") ]