Python入門-循環技巧介紹

本篇文章給大家帶來的內容是關於Python循環的技巧介紹,有一定的參考價值. 本文摘自千鋒教育《Python快樂編程》 當在字典中循環時,用 items() 方法可將關鍵字和對應的值同時取出 >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'} >>> for k, v in knights.items(): ...
相關文章
相關標籤/搜索