2014年7月6日日曜日

開発環境

Learning Python (Mark Lutz (著)、Oreilly & Associates Inc)のPART Ⅰ.(Getting Started)、Chapter 3(How You Run Programs)、Test Your Knowledge: Quize.を解いてみる。

その他参考書籍

Test Your Knowledge: Quize.

コード(BBEdit)

sample.py

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

print('Hello, world!')

入出力結果(Terminal, IPython)

$ ipython
Python 3.4.1 (default, May 21 2014, 01:39:38) 
Type "copyright", "credits" or "license" for more information.

IPython 2.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import sample
Hello, world!

In [2]: #!/usr/bin/env python3
#-*- coding: utf-8 -*-

print('Hello, world!')


In [3]: 
In [4]: 
In [4]: Hello, world!

In [5]: 
In [5]: import imp

In [6]: import sample

In [7]: imp.reload(sample)
Hello, world!
Out[7]: <module 'sample' from '/Users/kamimura/Documents/py/learning_py_en/ch3/sample.py'>

In [8]: exec("""
   ...: #!/usr/bin/env python3
#-*- coding: utf-8 -*-

print('Hello, world!')
""")
   ...:    ...:    ...:    ...: Hello, world!

In [9]: eval("""
   ...: #!/usr/bin/env python3
#-*- coding: utf-8 -*-

print('Hello, world!')
""")
   ...:    ...:    ...:    ...: Hello, world!

In [10]: quit()
$

0 コメント:

コメントを投稿