0848デフォルトの名無しさん
2018/05/06(日) 23:13:25.70ID:aIgnZyXqTypeError: 'dict_keys' object is not an iterator
と出るのですが、dict_keysオブジェクトってiteratorではないんですか?
Python3.0について解説しているブログによると、
d=dict(a=1, b=2, c=3)
ks = d.keys()
print(ks)
>>>dict_keys object at 0x33d9d0
print(next(ks))
>>>"a"
となるはずなんですけど、私のPCで実行してみると
print(ks)
>>>dict_keys(['a', 'b', 'c'])
print(next(ks))
>>>TypeError: 'dict_keys' object is not an iterator
と出ました。
これはブログの情報が古い(最新版のPythonではiteratorではない)
ということでしょうか?
実行環境はPycharmでPython3.6です