teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

サンプルを複数リストに変更

2018/09/23 09:11

投稿

opyon
opyon

スコア1009

answer CHANGED
@@ -4,32 +4,37 @@
4
4
  まとめてみました。
5
5
 
6
6
  ```Python3
7
+ import sys
8
+ print(sys.version)
9
+ hoge_list = ['hoge1','hoge2']
10
+ fuga_list = ['fuga1','fuga2']
11
+ piyo_list = ['piyo1','piyo2']
7
12
 
8
- hoge_list = ['hoge']
9
- fuga_list = ['fuga']
10
- piyo_list = ['piyo']
11
-
12
13
  src_list = [hoge_list,fuga_list,piyo_list]
13
14
  not_list = []
14
15
  client = 0
15
16
  _id = 0
16
17
 
17
- def get_account(x, client, _id):
18
+ def get_account(y, client, _id):
18
- print('test:',x, client, _id)
19
+ print('test:',y, client, _id)
19
20
 
20
21
  def func(src_list):
21
22
  for x in src_list:
23
+ for y in x:
22
- culculation = get_account(x, client, _id)
24
+ culculation = get_account(y, client, _id)
23
- if culculation is not None:
25
+ if culculation is not None:
24
- not_list.append(culculation)
26
+ not_list.append(culculation)
25
27
 
26
28
  func(src_list)
27
29
 
28
30
  ```
29
31
 
30
32
  ```
33
+ test: hoge1 0 0
31
- test: ['hoge'] 0 0
34
+ test: hoge2 0 0
35
+ test: fuga1 0 0
32
- test: ['fuga'] 0 0
36
+ test: fuga2 0 0
37
+ test: piyo1 0 0
33
- test: ['piyo'] 0 0
38
+ test: piyo2 0 0
34
39
 
35
40
  ```