いい関数ないんですかね。
使い方:dellist(リスト、削除したいインデックス)
dellist = lambda items, indexes: [item for index, item in enumerate(items) if index not in indexes]
A=["a","b","c","d","e","f","g","h"]
r=[0,4,5]
dellist(A,r)
>>['b', 'c', 'd', 'g', 'h']
Go to list of users who liked
More than 5 years have passed since last update.
いい関数ないんですかね。
使い方:dellist(リスト、削除したいインデックス)
dellist = lambda items, indexes: [item for index, item in enumerate(items) if index not in indexes]
A=["a","b","c","d","e","f","g","h"]
r=[0,4,5]
dellist(A,r)
>>['b', 'c', 'd', 'g', 'h']
Register as a new user and use Qiita more conveniently
Go to list of users who liked