開発環境
- OS X Mavericks - Apple(OS)
- Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
- Python (プログラミング言語)
Learning Python (Mark Lutz (著)、Oreilly & Associates Inc)のPART Ⅰ.(Getting Started)、Test Your Knowledge: Part Ⅰ Exercises 2.(Programs)を解いてみる。
その他参考書籍
Test Your Knowledge: Part Ⅰ Exercises 2.(Programs)
コード(BBEdit)
module1.py
#!/usr/bin/env python3 #-*- coding: utf-8 -*- print('Hello module world!')
入出力結果(Terminal, IPython)
$ python3 module1.py Hello module world! $ chmod a+x module1.py $ ./module1.py Hello module world! $ 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 module1 Hello module world! In [2]: import module1 In [3]: import imp In [4]: imp.reload(module1) Hello module world! Out[4]: <module 'module1' from '/Users/kamimura/Documents/py/learning_py_en/part1/module1.py'> In [5]: exec(""" ...: print('Hello module world!') ...: """) Hello module world! In [6]: eval(""" ...: print('Hello module world!') ...: """) Hello module world! In [7]: quit() $
0 コメント:
コメントを投稿