2014年12月21日日曜日

開発環境

Introducing Python: Modern Computing in Simple Packages(Bill Lubanovic (著)、 O'Reilly Media)のChapter 4(Py Crust: Code Structures)、Things to Do 4.7.を解いてみる。

Things to Do 4.7.

コード(BBEdit)

sample7.py

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

for s in ('Got {0}'.format(n) for n in range(10)):
    print(s)

入出力結果(Terminal, IPython)

$ ./sample7.py
Got 0
Got 1
Got 2
Got 3
Got 4
Got 5
Got 6
Got 7
Got 8
Got 9
$

0 コメント:

コメントを投稿