対話モード(Python Shell)

スタート→「プログラム」→「Python 2.3」→「Idle(Python GUI)」
Python Shellというwindowが起動し以下のメッセージが表示されるはず。

Python 2.3.4 (#53, Sep 20 2004, 11:44:16) [MSC v.1200 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

    ****************************************************************
    Personal firewall software may warn about the connection IDLE
    makes to its subprocess using this computer's internal loopback
    interface.  This connection is not visible on any external
    interface and no data is sent to or received from the Internet.
    ****************************************************************
    
IDLE 1.0.3 
    
とりあえず、色々試してる。
>>> print "hello world"
hello world
>>> a = 5
>>> b = 10
>>> print a + b
15
>>> 
対話モードはプログラムの動作をちょっと試したり、簡単な作業をするときにとても便利。 ▼リスタート(リセット) 【Ctrl + F6】 コントロールキーとF6キーの同時押しでPyhton Shellをリスタートできる。
>>> a = "test"
>>> print a
test
>>> #【Ctrl + F6】を押す
>>> ========================= RESTART =========================
>>> print a

Traceback (most recent call last):
  File "", line 1, in -toplevel-
    print a
NameError: name 'a' is not defined
>>> 
リスタートすると、変数などがすべてリセットされる。 参考:2.1.2 対話モード http://www.python.jp/doc/release/tut/node4.html#SECTION004120000000000000000