2012年9月28日金曜日

開発環境

『初めてのPython 第3版』(Mark Lutz 著、夏目 大 訳、オライリー・ジャパン、2009年、ISBN978-4-87311-393-7) のI部(Pythonの基礎知識)のまとめ演習を解いてみる。

その他参考書籍

コード(TextWrangler)

sample.py

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

print("Hello, World!")

入出力結果(Terminal)

$ python
Python 3.2.3 (default, Apr 18 2012, 20:17:30) 
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
<<< "Hello, World!"
'Hello, World!'
<<< import sample
Hello, World!
<<< quit()
$ ./sample.py
Hello, World!
$ python
Python 3.2.3 (default, Apr 18 2012, 20:17:30) 
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
<<< 1/0
Traceback (most recent call last):
  File "<stdin<", line 1, in <module<
ZeroDivisionError: division by zero
<<< l=[1,2]
<<< l
[1, 2]
<<< l.append(l)
<<< l
[1, 2, [...]]
<<< quit()
$

0 コメント:

コメントを投稿