開発環境
- OS X Mavericks - Apple(OS)
- Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
- Python (プログラミング言語)
Learning Python (Mark Lutz (著)、Oreilly & Associates Inc)のPART V.(Modules and Packages)、Test Your Knowledge: Part V Exercises 6(Reloads)を解いてみる。
その他参考書籍
6(Reloads)
コード(BBEdit)
changer.py
#!/usr/bin/env python3 #-*- coding: utf-8 -*- # 変更前 # message = "First version" # 変更後 message = "Second version" def printer(): print(message)
入出力結果(Terminal)
$ python3 Python 3.3.5 (default, Mar 15 2014, 14:51:54) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import changer >>> changer.printer() First version >>> C-c C-z [2]+ Stopped python3 $ fg python3 import changer >>> changer.printer() First version >>> import imp >>> imp.reload(changer) <module 'changer' from './changer.py'> >>> changer.printer() Second version >>> quit() $
0 コメント:
コメントを投稿