【Python】Python - 迴圈Set。Python Loop Set.

 【Python】Python - 迴圈Set。Python Loop Set.


使用迴圈存取 Items

你可以使用for 迴圈去對 set裡面的item存取:

範例

下面的範例為對set做迴圈,並列印值:

Loop through the set, and print the values:

thisset = {"apple""banana""cherry"}

for x in thisset:
  print(x)
上面輸出: 
cherry
banana
apple



留言

這個網誌中的熱門文章

【多益】現點現做的英文怎麼說呢?

《Microsoft Word 應用》:圖片被文字蓋住解決方法,不可設定為固定行高

UBUNTU中轉換磁碟partition 從 MBR轉為GPT,不損失資料