Re: [問題] 在iterator得到current index

看板Python作者 (cablin)時間13年前 (2012/03/14 03:44), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
隨手寫個不需要知道index的方法.. mylist_r = mylist[:] mylist_l = [] for cur_item in mylist: if ... : ... split_item = ... mylist_l.append(mylist_r[0]) mylist_r[0] = split_item mylist[:] = mylist_l + mylist_r else: ... mylist_l.append(mylist_r.pop(0)) -- 「死ぬのっていや? 殺されたくない?」 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.217.2
文章代碼(AID): #1FNwEcpZ (Python)
文章代碼(AID): #1FNwEcpZ (Python)