Hello Python †対話シェルから「Hello Python」を表示する †「>>>」が表示されたら、「print "Hello Python"」 と入力しEnterキーを押すと、「Hello Python」と表示される。 # python Python 2.5 (r25:51908, Jun 16 2008, 13:58:39) [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print "Hello Python" Hello Python >>> ipythonを起動して「Hello Python」を表示する †「In [1]:」が表示されたら、「print "Hello Python"」 と入力しEnterキーを押すと、「Hello Python」と表示される。 # ipython ********************************************************************** Welcome to IPython. I will try to create a personal configuration directory where you can customize many aspects of IPython's functionality in: /root/.ipython Initializing from configuration /usr/local/python/lib/python2.5/site-packages/ip ython-0.8.4-py2.5.egg/IPython/UserConfig Successful installation! Please read the sections 'Initial Configuration' and 'Quick Tips' in the IPython manual (there are both HTML and PDF versions supplied with the distribution) to make sure that your system environment is properly configured to take advantage of IPython's features. Important note: the configuration system has changed! The old system is still in place, but its setting may be partly overridden by the settings in "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file if some of the new settings bother you. Please press <RETURN> to start IPython. ********************************************************************** Python 2.5 (r25:51908, Jun 16 2008, 13:58:39) Type "copyright", "credits" or "license" for more information. IPython 0.8.4 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. In [1]: print "Heloo Python" Heloo Python In [2]: .pyファイルを作成し「Hello Python」を表示する †ファイルを開く †# vim sample.py 以下を記述する。 †#!/usr/bin/env python #-*- coding:utf-8 -*- print "Hello Python" パーミッションを変更する †# chmod 755 sample.py 実行する †# python ./sample.py Hello Python Comment †
Counter: 10606,
today: 1,
yesterday: 1
|