Doge log

Abby CTO 雑賀 力王のオフィシャルサイトです

Python3000のリスト内包表記

Python 3.1a0 (py3k:67517, Dec 4 2008, 22:33:17)
[GCC 4.0.1 (Apple Inc. build 5484)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> l = [n for n in range(5)]
>>> l
[0, 1, 2, 3, 4]
>>> l.__class__

>>> s = {n for n in range(5)}
>>> s
{0, 1, 2, 3, 4}
>>> s.__class__

>>> d = {n:n for n in range(5)}
>>> d
{0: 0, 1: 1, 2: 2, 3: 3, 4: 4}
>>> d.__class__

おー出来た!なんかすげー!!!