久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      python中pop()函數(shù)如何使用

      python中pop()函數(shù)如何使用

      pop() 函數(shù)用于移除列表中的一個(gè)元素(默認(rèn)最后一個(gè)元素),并且返回該元素的值。

      語法:

      list.pop(obj=list[-1])       //默認(rèn)為 index=-1,刪除最后一個(gè)列表值。 //obj -- 可選參數(shù),要移除列表元素的對(duì)象。

      該方法返回從列表中移除的元素對(duì)象。

      實(shí)例:

      sentence=['All', 'good', 'things', 'come', 'to' ,'those', 'who', 'wait.']  print("默認(rèn)為 index=-1,刪除最后一個(gè)列表值:",sentence.pop(-1),"n") print("默認(rèn)刪除最后一個(gè)列表值: ",sentence.pop(),"n") print("刪除第一個(gè)元素:",sentence.pop(0),"n") print("刪除第三個(gè)元素:",sentence.pop(2),"n") print("輸出剩余元素:",sentence)

      運(yùn)行結(jié)果為:(該方法返回從列表中移除的元素對(duì)象。)每執(zhí)行print()一下就移除一個(gè)。

      python中pop()函數(shù)如何使用

      推薦教程:python教程

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)