-1
我學習一些Python,和我有以下程序:Python的理解和數據結構
sentence = "the quick brown fox jumps over the lazy dog"
words = sentence.split()
print "\n What the hell is this???"
word_lengths = [(word, len(word)) for word in words if word != "the".lower()]
print word_lengths
What the hell is this???
[('quick', 5), ('brown', 5), ('fox', 3), ('jumps', 5), ('over', 4), ('lazy', 4), ('dog', 3)]
我不明白的奇怪的名單,我與後者塊O編碼得到..
它是什麼樣的結構?
在此先感謝!
這是一個元組列表。有什麼問題? –
你可以閱讀關於元組和序列[這裏](https://docs.python.org/3.5/tutorial/datastructures.html#tuples-and-sequences)。 –
謝謝大家,這就是我需要的! – S4rg0n