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