官網:www.python.orgpython
Python主流的版本2.6\7bash
1.CentOS查看Python版本號ide
[root@host ~]#python –V #查看python版本號 Python2.6.6
2.進入Python命令行模式spa
>>>print "hello world" #打印hello world helloworld
3.如何編寫Python腳本命令行
[root@host python]# cat test.py #!/usr/bin/env python #也可使用#!/usr/bin/python print"hello world" #打印hello world
4.如何運行Python腳本編譯器
[root@host python]# python test.py #第一種執行方法 helloworld [root@host python]# chmod 755 test.py #第二種執行方法 [root@host python]# ./test.py helloworld
5.如何導入模塊虛擬機
>>>import test [root@host python]# ls test.py test.pyc #會產生一個文件test.pyc,緣由是由於python已經裝了一個虛擬機的編譯器, 由這個虛擬機去讀取我寫的代碼,而後轉換給c語言而後在系統上去執行。當我導入test.py模塊,就會 被轉換成c語言。