Python 3 教程

來源:互聯網
上載者:User

標籤:com   指令碼   python3.x   檔案中   程式   版本   string   查看   程式語言   

查看python版本

我們可以在命令視窗(Windows 使用 win+R 調出 cmd 運行框)使用以下命令查看我們使用的Python版本:

python -V

以上命令執行結果如下:

Python 3.3.2
第一個Python3.x程式

對於大多數程式語言,第一個入門編程代碼便是"Hello World!",以下代碼為使用Python輸出"Hello World!":

執行個體(Python 3.0+)#!/usr/bin/python3 print("Hello, World!")

你可以將以上代碼儲存在 hello.py 檔案中並使用 python 命令執行該指令檔。

$ python3 hello.py

以上命令輸出結果為:

Hello, World!

 1開啟shell  建立檔案


2 在建立檔案中加入

#!/usr/bin/python3
 
print("Hello, World!")

 

3 運行

 


Python 3 教程

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.