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:

Initializing from configuration /usr/local/python/lib/python2.5/site-packages/ip

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


  • #-*- conding:utf-8 -*- の部分は # vim: fileencoding=utf-8 : でも良いよ。 -- nobu? 2008-06-16 (月) 23:04:15
  • そなのですね!ありがとうございます~。 -- minaco? 2008-06-26 (木) 11:27:27
  • Aloha! vkh -- Gundoslqh? 2009-11-17 (火) 07:26:56

Counter: 7938, today: 2, yesterday: 0

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2013-09-24 (火) 14:56:29 (1280d)