回答編集履歴

2

誤字

2018/03/21 09:47

投稿

katoy
katoy

スコア22324

test CHANGED
@@ -1 +1 @@
1
- 2重投稿になったで削除
1
+ 2重投稿になったで削除

1

削除

2018/03/21 09:47

投稿

katoy
katoy

スコア22324

test CHANGED
@@ -1,29 +1 @@
1
- ```python
1
+ 2重投稿になったおで削除
2
-
3
- list(map(lambda x: list1.index(x) if x in list1 else None, list2))
4
-
5
- ```
6
-
7
-
8
-
9
- 実行例
10
-
11
- ![イメージ説明](dc95ca29c360e3e06088ac78698be7d1.png)
12
-
13
-
14
-
15
- list1 に存在しない要素が list2 にある場合は None となるようにしてます。
16
-
17
-
18
-
19
- list1 に重複した要素がある場合への対応案もあります。
20
-
21
- ```python
22
-
23
- list(map(lambda x: [i for i, elem in enumerate(list1) if elem == x], list2))
24
-
25
- ```
26
-
27
- 実行例
28
-
29
- ![イメージ説明](a8a48544896ff1407d7a0ee76888706a.png)