直接上內容:
print隔行 / 連續 / 間隔輸出print(a) == print(a,end='\n') print(a, end='') print(a, end=' ')
運算子
/(除)(-13)/3 = -5 # 3*(-5)<-13<3*(-4)%(取模)(-13)%3 = 2 # |(-13)-(-15)| = 2
控制流
if陳述句if a<b: elif a>b: #用于再判斷 else:while陳述句while true: if a < b: break #不再執行后面的陳述句,跳出while回圈 elif a > b: continue #不再執行后面的陳述句,重新while回圈 else: else:for陳述句for a > b: else: 可選range(a,b)左包括右不包括range(1,4) = [1,2,3] range(1,4,2) = [1,3]
函式
- 區域變數
# 函式里的變數只在函式內部有效 x =50 def func(x): print('x is', x) x = 2 print('Changed local x to', x) func(x) print('x is still', x) # 輸出 x is 50 changed local x to 2 x is still 50 global陳述句x =50 def func(): global x print('x is', x) x = 2 print('Changed global x to', x) func() print('Value of x is', x) # 輸出 x is 50 changed global x to 2 value of x is 2- 默認引數
def func(a, b=5) #有效 def func(a=5,b) #無效 - 檔案字串
def max(a,b): '''選取最大值''' help(max) # 輸出 max(a,b) 選取最大值
資料結構
- 串列 & 元組
元組相當于只讀的串列
解決問題的思路
zip命令- 添加至系統變數(path)后重啟 pycharm
- 用戶變數只針對當前用戶
- 系統變數針對所有用戶
總結:其實學好Python,最難的是堅持,如果你擔心堅持不了可以去小編的Python全堆疊學習交流.裙 :一久武其而而流一思(數字的諧音)轉換下可以找到了,不懂的問題有老司機解決里面還有最新Python教程專案免費下,,一起相互監督共同進步!本文的文字及圖片來源于網路加上自己的想法,僅供學習、交流使用,不具有任何商業用途,著作權歸原作者所有,如有問題請及時聯系我們以作處理,
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/192491.html
標籤:Python
