python 識別符號
第乙個字元必須是下劃線或者是字母(大小寫)
其他由字母(大小寫)、下劃線、數字組成
注:1.python對大小寫非常敏感 myname 和myname是兩個不同的識別符號
2.不需要宣告或定義資料型別
注釋:單行 #print('hello,world')
多行
'''i = 5
print (i)
i = i + 1
print(i)』』』
輸出:
s = thisisa aaa。thisisthe second line
(s)
if迴圈:
python2獲取鍵盤輸入的值是 raw_input()
python3是input()
number =
23a =
input
("enter:")
guss =
int(a)
ifguss == number:
('1')
('2')
elifguss < number:
print(3
)else:
print(4
('done')
輸出結果:
enter:56
4
enter:12
3
enter:23
1
2
使用continue語句:while true:s =
input
('enter:')
ifs =='quit':
break
iflen
(s) < 3:
continue
('input is of sufficient length')
enter
:a
enter:12
enter:abc
input is of sufficient length
enter:quit
結束
函式(定義函式)
defsayhello():('hello')
sayhello()
def printmax(a, b):
if a > b:
print a, 'is maximum'
else:
print b, 'is maximum'
printmax(3, 4)
x = 5 y = 7
printmax(x, y)
4 is maximum
7 is maximum
區域性變數:結果:x is 50def func(x):
print('x is ',x)
x = 2
print('x changed ',x)
x = 50
func(x)
print('x is still ',x)
x changed 2
x is still 50
使用global語句:被用來宣告x是全域性的
deffunc():mysql:globalx
('x is ',x)
x =
2
('x changed ',x)
x =
50func()
('x is still ',x)
多表連線:inner join on
inner join (等值連線):只返回兩個表中連線字段相等的行
left join on (左連線):返回包括左表中的所有記錄和右表中連線字段相等的記錄(以左表為準)
right join on(右連線):返回包括右表中的所有記錄和左表中連線字段相等的記錄
ARP協議做了什麼事情?
arp address resolution protocol,位址解析協議 是將ip位址解析為乙太網mac位址 或稱實體地址 的協議。在區域網中,當主機或其它網路裝置有資料要傳送給另乙個主機或裝置時,它必須知道對方的網路層位址 即ip位址 但是僅僅有ip位址是不夠的,因為ip資料報文必須封裝成幀才...
OkHttp 為我們做了什麼事情
1.提供了對http2和spdy的支援,共享同乙個主機的套接字連線。2.若http2和spdy不可用,提供連線池復用連線。3.預設gzip壓縮傳輸內容。4.快取響應。5.自動重連乙個主機的多個ip位址。引申問題,http2和spdy做了什麼 spdy是對http1.x的優化,http2是http1....
handler傳送訊息之後做了什麼事情。
首先來看handler發訊息的幾個方式 handler提供了好幾個傳送訊息的方式。post系列和sendmessage系列都是差不多的最終都會呼叫sendmessageattime 函式 這裡用post系枚舉例 handler.post runnable r 入參是乙個runnable。看看裡面做了...