Skip to content

Instantly share code, notes, and snippets.

@banyan
Created February 11, 2010 02:49
Show Gist options
  • Select an option

  • Save banyan/301153 to your computer and use it in GitHub Desktop.

Select an option

Save banyan/301153 to your computer and use it in GitHub Desktop.
# 以前の Python では keys メソッドを呼び出す必要があったが、
# 最近の Python では必要がなくなった。
D = {'a':1, 'b': 2, 'c': 3}
for key in D.keys():
print key, D[key]
for key in D:
print key, D[key]
#a 1
#c 3
#b 2
#a 1
#c 3
#b 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment