回答編集履歴
1
ソースの追記
answer
CHANGED
@@ -24,4 +24,48 @@
|
|
24
24
|
d
|
25
25
|
e
|
26
26
|
f
|
27
|
+
```
|
28
|
+
|
29
|
+
|
30
|
+
2016/8/28追記:
|
31
|
+
0or1のある・ないだけ知れば良いのであればディクショナリ型を使うまでもなさそうですね。
|
32
|
+
set型にしてitem名だけ保持させて、呼び出し時に判定します。
|
33
|
+
|
34
|
+
```python
|
35
|
+
table = []
|
36
|
+
|
37
|
+
table.append(["a","c","d"])
|
38
|
+
table.append(["a","b"])
|
39
|
+
table.append(["a","d"])
|
40
|
+
|
41
|
+
print "a" in table[0]
|
42
|
+
print "b" in table[0]
|
43
|
+
print "c" in table[0]
|
44
|
+
print "d" in table[0]
|
45
|
+
|
46
|
+
print "a" in table[1]
|
47
|
+
print "b" in table[1]
|
48
|
+
print "c" in table[1]
|
49
|
+
print "d" in table[1]
|
50
|
+
|
51
|
+
print "a" in table[2]
|
52
|
+
print "b" in table[2]
|
53
|
+
print "c" in table[2]
|
54
|
+
print "d" in table[2]
|
55
|
+
```
|
56
|
+
|
57
|
+
実行結果
|
58
|
+
```
|
59
|
+
True
|
60
|
+
False
|
61
|
+
True
|
62
|
+
True
|
63
|
+
True
|
64
|
+
True
|
65
|
+
False
|
66
|
+
False
|
67
|
+
True
|
68
|
+
False
|
69
|
+
False
|
70
|
+
True
|
27
71
|
```
|