Pythonメモ
◎the list comprehension
特定の条件に従ってリストを作成する場合に使える。
for/in構文とif文を使用してリストを作成する。
下記は0から50までの数字の中で、2で割り切れるもの(偶数)をリストに詰める例。
evens_to_50 = [i for i in range(51) if i % 2 == 0] print evens_to_50
結果は次。
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50]
◎pass文
何もしない文。
class TestClass(object): pass
2016年10月7日21:30@JST発表の9月NFP(米国雇用統計)は15.6万人(予想:17.5万人)で予想より悪く、失業率も5.0%(予想:4.9%)で予想より悪くドル円下落
雇用統計は予想よりも悪かった。
September Payrolls 156K,, Exp. 175K
— zerohedge (@zerohedge) 2016年10月7日
失業率も悪かった。
Payrolls Rise 156K, Missing Expectations, Unemployment Rate Rises To 5.0% https://t.co/6OYSCMTWZ3
— zerohedge (@zerohedge) 2016年10月7日