Python 環境搭建,開發工具,基本文法,python基本文法

來源:互聯網
上載者:User

Python 環境搭建,開發工具,基本文法,python基本文法
python環境

https://www.python.org/downloads/

現在pthon有兩個版本 一個是3.5系列的 , 一個是2.7系列的。建議用3.5版本的

 

開發工具

PyCharm   https://www.jetbrains.com/pycharm/

這個工具是收費的,可以百度一個破解碼

 

學習教程

http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000

 

# if  elsemoney = 20if money > 10 :    print( money )else:    print( -money )# 換行用print()print( "\n" )#多行輸出#如果字串內部有很多換行,用\n寫在一行裡不好閱讀,為了簡化,Python允許用'''...'''的格式表示多行內容,可以自己試試:print( '''dsdsdsddsdsdssdsdsd''')##布爾值print( 3 > 5 )print( 10> 1 )## and 運算子 相當於java裡面的 &&check = 3> 1 and 5>3print( "and " ,check )## or 運算子 相當於java裡面的 ||check = 3> 1 or 5 < 3print( "or " , check )## not 運算子 相當於java 裡面的 !check = not  3> 1print( "not " ,check )#動態語言a = "abc"  #定義一個變數為a ,a此時的類型為字串a= 10  #把整形10賦值給a ,a此時是整形#總結 像這樣的不用指定變數類型的語言稱之為動態語言,java 就是靜態語言,java 中的變數必須指定類型#常量  常量名必須大寫API = "www.baidu.com"#除法1  / 結果是浮點數,即使可以整除,結果也是浮點數print( 10 / 3 )   # 3.3333333333333335print( 3 / 10 )   # 0.3print( 10 / 2 )   # 5.0##除法2  // 結果是整數,即使不能整除,結果也是整數print( 10 // 3 )   # 3print( 10 // 2 )   # 5print( 1 // 10 )   # 0# 求餘print( 1 % 3 )    # 1print(  2 % 4 )   # 2print( 4 % 2 )    # 0

  

 

聯繫我們

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