回答編集履歴

4

誤植の修正

2017/07/17 15:03

投稿

LouiS0616
LouiS0616

スコア35660

test CHANGED
@@ -54,7 +54,7 @@
54
54
 
55
55
 
56
56
 
57
- updataメソッドの引数は辞書型なのですね。
57
+ updateメソッドの引数は辞書型なのですね。
58
58
 
59
59
 
60
60
 

3

良さげなサイトを発見

2017/07/17 15:03

投稿

LouiS0616
LouiS0616

スコア35660

test CHANGED
@@ -145,3 +145,9 @@
145
145
 
146
146
 
147
147
  うん、予想通り。
148
+
149
+
150
+
151
+ ---
152
+
153
+ [色んな引数の与え方がある](http://st-president-program.seesaa.net/article/420910487.html)んですね。

2

実験追記

2017/07/17 14:15

投稿

LouiS0616
LouiS0616

スコア35660

test CHANGED
@@ -94,4 +94,54 @@
94
94
 
95
95
 
96
96
 
97
+ 実験してみました
98
+
97
- -
99
+ ---
100
+
101
+ ```Python
102
+
103
+ def func(*args, **kwargs):
104
+
105
+ for dictarg in args:
106
+
107
+ kwargs.update(dictarg)
108
+
109
+
110
+
111
+ print(kwargs)
112
+
113
+
114
+
115
+ tmplist = list(range(4))
116
+
117
+ func(a=tmplist)
118
+
119
+ func({'b': tmplist})
120
+
121
+ func(tmplist)
122
+
123
+ """ 実行結果
124
+
125
+ {'a': [0, 1, 2, 3]}
126
+
127
+ {'b': [0, 1, 2, 3]}
128
+
129
+ Traceback (most recent call last):
130
+
131
+ File "tmptest.py", line 10, in <module>
132
+
133
+ func(tmplist)
134
+
135
+ File "tmptest.py", line 3, in func
136
+
137
+ kwargs.update(dictarg)
138
+
139
+ TypeError: cannot convert dictionary update sequence element #0 to a sequence
140
+
141
+ """
142
+
143
+ ```
144
+
145
+
146
+
147
+ うん、予想通り。

1

--

2017/07/17 14:08

投稿

LouiS0616
LouiS0616

スコア35660

test CHANGED
@@ -91,3 +91,7 @@
91
91
  return template('index', {'row': row})
92
92
 
93
93
  ```
94
+
95
+
96
+
97
+ -