python的基礎學習

來源:互聯網
上載者:User

標籤:如何   開發流程   pytho   安裝   劃線   互動   語言   windows   流程   

windows下   查詢python的位置  which python   查詢python的版本  python -V   列出目前的目錄下的檔案 dir   切換目錄 cd

1、 python的互動模式

  1. 命令列直接進入 鍵入python
  2. 運行idle 建立.py格式檔案

2、 python的開發流程

  1. 建立以./py為結尾的檔案
  2. 命令列下 鍵入 python+檔案名稱.py 執行python檔案

3、 如何安裝ipython
pip install ipython [all]

4、 python

python print("this is my son") print("my name is" + "xutonghui") #字串可以使用加號拼接,拼接內容僅限字串 print("i am ok","thank you") #字串可以使用逗號隔開

命名規則

字母,數字,底線組成
不能以數字開頭
命名要有意義
嚴格區分大小寫
不能使用標識符和關鍵字(標識符是自訂的,關鍵字是內建的)


python是強型別,動態類型的語言

強型別是指文法嚴格,動態類型就是定義變數時不需要標識類型
變數的賦值 =

檢查變數的類型 type()

num1=123print(type(num1))

判斷變數的字面值

num1=123num2=121print(num1==num2)#最後返回的值  true或false

判斷引用對象的地址值是否相同

num1=345num2=345print(num1 is num2)#最後返回的值  true或false

檢測對象的地址值 id()

num1=kkkprint(id(num1))

python的基礎學習

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.