日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > python >内容正文

python

有没有python的班_【万字长文】别再报班了,一篇文章带你入门Python

發(fā)布時(shí)間:2023/12/19 python 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 有没有python的班_【万字长文】别再报班了,一篇文章带你入门Python 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

最近有許多小伙伴后臺(tái)聯(lián)系我,說目前想要學(xué)習(xí)Python,但是沒有一份很好的資料入門。一方面的確現(xiàn)在市面上Python的資料過多,導(dǎo)致新手會(huì)不知如何選擇,另一個(gè)問題很多資料內(nèi)容也很雜,從1+1到深度學(xué)習(xí)都包括,純粹關(guān)注Python本身語法的優(yōu)質(zhì)教材并不太多。

剛好我最近看到一份不錯(cuò)的英文Python入門資料,我將它做了一些整理和翻譯寫下了本文。這份資料非常純粹,只有Python的基礎(chǔ)語法,專門針對(duì)想要學(xué)習(xí)Python的小白。

注釋

Python中用#表示單行注釋,#之后的同行的內(nèi)容都會(huì)被注釋掉。

# Python中單行注釋用#表示,#之后同行字符全部認(rèn)為被注釋。

使用三個(gè)連續(xù)的雙引號(hào)表示多行注釋,兩個(gè)多行注釋標(biāo)識(shí)之間內(nèi)容會(huì)被視作是注釋。

""" 與之對(duì)應(yīng)的是多行注釋

用三個(gè)雙引號(hào)表示,這兩段雙引號(hào)當(dāng)中的內(nèi)容都會(huì)被視作是注釋

"""

基礎(chǔ)變量類型與操作符

Python當(dāng)中的數(shù)字定義和其他語言一樣:

#獲得一個(gè)整數(shù)

3

# 獲得一個(gè)浮點(diǎn)數(shù)

10.0

我們分別使用+, -, *, /表示加減乘除四則運(yùn)算符。

1 + 1 # => 2

8 - 1 # => 7

10 * 2 # => 20

35 / 5 # => 7.0

這里要注意的是,在Python2當(dāng)中,10/3這個(gè)操作會(huì)得到3,而不是3.33333。因?yàn)槌龜?shù)和被除數(shù)都是整數(shù),所以Python會(huì)自動(dòng)執(zhí)行整數(shù)的計(jì)算,幫我們把得到的商取整。如果是10.0 / 3,就會(huì)得到3.33333。目前Python2已經(jīng)不再維護(hù)了,可以不用關(guān)心其中的細(xì)節(jié)。

但問題是Python是一個(gè)弱類型的語言,如果我們?cè)谝粋€(gè)函數(shù)當(dāng)中得到兩個(gè)變量,是無法直接判斷它們的類型的。這就導(dǎo)致了同樣的計(jì)算符可能會(huì)得到不同的結(jié)果,這非常蛋疼。以至于程序員在運(yùn)算除法的時(shí)候,往往都需要手工加上類型轉(zhuǎn)化符,將被除數(shù)轉(zhuǎn)成浮點(diǎn)數(shù)。

在Python3當(dāng)中撥亂反正,修正了這個(gè)問題,即使是兩個(gè)整數(shù)相除,并且可以整除的情況下,得到的結(jié)果也一定是浮點(diǎn)數(shù)。

如果我們想要得到整數(shù),我們可以這么操作:

5 // 3 # => 1

-5 // 3 # => -2

5.0 // 3.0 # => 1.0 # works on floats too

-5.0 // 3.0 # => -2.0

兩個(gè)除號(hào)表示取整除,Python會(huì)為我們保留去除余數(shù)的結(jié)果。

除了取整除操作之外還有取余數(shù)操作,數(shù)學(xué)上稱為取模,Python中用%表示。

# Modulo operation

7 % 3 # => 1

Python中支持乘方運(yùn)算,我們可以不用調(diào)用額外的函數(shù),而使用**符號(hào)來完成:

# Exponentiation (x**y, x to the yth power)

2**3 # => 8

當(dāng)運(yùn)算比較復(fù)雜的時(shí)候,我們可以用括號(hào)來強(qiáng)制改變運(yùn)算順序。

# Enforce precedence with parentheses

1 + 3 * 2 # => 7

(1 + 3) * 2 # => 8

邏輯運(yùn)算

Python中用首字母大寫的True和False表示真和假。

True # => True

False # => False

用and表示與操作,or表示或操作,not表示非操作。而不是C++或者是Java當(dāng)中的&&, || 和!。

# negate with not

not True # => False

not False # => True

# Boolean Operators

# Note "and" and "or" are case-sensitive

True and False # => False

False or True # => True

在Python底層,True和False其實(shí)是1和0,所以如果我們執(zhí)行以下操作,是不會(huì)報(bào)錯(cuò)的,但是在邏輯上毫無意義。

# True and False are actually 1 and 0 but with different keywords

True + True # => 2

True * 8 # => 8

False - 5 # => -5

我們用==判斷相等的操作,可以看出來True==1, False == 0.

# Comparison operators look at the numerical value of True and False

0 == False # => True

1 == True # => True

2 == True # => False

-5 != False # => True

我們要小心Python當(dāng)中的bool()這個(gè)函數(shù),它并不是轉(zhuǎn)成bool類型的意思。如果我們執(zhí)行這個(gè)函數(shù),那么只有0會(huì)被視作是False,其他所有數(shù)值都是True:

bool(0) # => False

bool(4) # => True

bool(-6) # => True

0 and 2 # => 0

-5 or 0 # => -5

Python中用==判斷相等,>表示大于,>=表示大于等于, <表示小于,<=表示小于等于,!=表示不等。

# Equality is ==

1 == 1 # => True

2 == 1 # => False

# Inequality is !=

1 != 1 # => False

2 != 1 # => True

# More comparisons

1 < 10 # => True

1 > 10 # => False

2 <= 2 # => True

2 >= 2 # => True

我們可以用and和or拼裝各個(gè)邏輯運(yùn)算:

# Seeing whether a value is in a range

1 < 2 and 2 < 3 # => True

2 < 3 and 3 < 2 # => False

# Chaining makes this look nicer

1 < 2 < 3 # => True

2 < 3 < 2 # => False

注意not,and,or之間的優(yōu)先級(jí),其中not > and > or。如果分不清楚的話,可以用括號(hào)強(qiáng)行改變運(yùn)行順序。

list和字符串

關(guān)于list的判斷,我們常用的判斷有兩種,一種是剛才介紹的==,還有一種是is。我們有時(shí)候也會(huì)簡(jiǎn)單實(shí)用is來判斷,那么這兩者有什么區(qū)別呢?我們來看下面的例子:

a = [1, 2, 3, 4] # Point a at a new list, [1, 2, 3, 4]

b = a # Point b at what a is pointing to

b is a # => True, a and b refer to the same object

b == a # => True, a's and b's objects are equal

b = [1, 2, 3, 4] # Point b at a new list, [1, 2, 3, 4]

b is a # => False, a and b do not refer to the same object

b == a # => True, a's and b's objects are equal

Python是全引用的語言,其中的對(duì)象都使用引用來表示。is判斷的就是兩個(gè)引用是否指向同一個(gè)對(duì)象,而==則是判斷兩個(gè)引用指向的具體內(nèi)容是否相等。舉個(gè)例子,如果我們把引用比喻成地址的話,is就是判斷兩個(gè)變量的是否指向同一個(gè)地址,比如說都是沿河?xùn)|路XX號(hào)。而==則是判斷這兩個(gè)地址的收件人是否都叫張三。

顯然,住在同一個(gè)地址的人一定都叫張三,但是住在不同地址的兩個(gè)人也可以都叫張三,也可以叫不同的名字。所以如果a is b,那么a == b一定成立,反之則不然。

Python當(dāng)中對(duì)字符串的限制比較松,雙引號(hào)和單引號(hào)都可以表示字符串,看個(gè)人喜好使用單引號(hào)或者是雙引號(hào)。我個(gè)人比較喜歡單引號(hào),因?yàn)閷懫饋矸奖恪?/p>

字符串也支持+操作,表示兩個(gè)字符串相連。除此之外,我們把兩個(gè)字符串寫在一起,即使沒有+,Python也會(huì)為我們拼接:

# Strings are created with " or '

"This is a string."

'This is also a string.'

# Strings can be added too! But try not to do this.

"Hello " + "world!" # => "Hello world!"

# String literals (but not variables) can be concatenated without using '+'

"Hello " "world!" # => "Hello world!"

我們可以使用[]來查找字符串當(dāng)中某個(gè)位置的字符,用len來計(jì)算字符串的長(zhǎng)度。

# A string can be treated like a list of characters

"This is a string"[0] # => 'T'

# You can find the length of a string

len("This is a string") # => 16

我們可以在字符串前面加上f表示格式操作,并且在格式操作當(dāng)中也支持運(yùn)算,比如可以嵌套上len函數(shù)等。不過要注意,只有Python3.6以上的版本支持f操作。

# You can also format using f-strings or formatted string literals (in Python 3.6+)

name = "Reiko"

f"She said her name is {name}." # => "She said her name is Reiko"

# You can basically put any Python statement inside the braces and it will be output in the string.

f"{name} is {len(name)} characters long." # => "Reiko is 5 characters long."

最后是None的判斷,在Python當(dāng)中None也是一個(gè)對(duì)象,所有為None的變量都會(huì)指向這個(gè)對(duì)象。根據(jù)我們前面所說的,既然所有的None都指向同一個(gè)地址,我們需要判斷一個(gè)變量是否是None的時(shí)候,可以使用is來進(jìn)行判斷,當(dāng)然用==也是可以的,不過我們通常使用is。

# None is an object

None # => None

# Don't use the equality "==" symbol to compare objects to None

# Use "is" instead. This checks for equality of object identity.

"etc" is None # => False

None is None # => True

理解了None之后,我們?cè)倩氐街敖榻B過的bool()函數(shù),它的用途其實(shí)就是判斷值是否是空。所有類型的默認(rèn)空值會(huì)被返回False,否則都是True。比如0,"",[], {}, ()等。

# None, 0, and empty strings/lists/dicts/tuples all evaluate to False.

# All other values are True

bool(None)# => False

bool(0) # => False

bool("") # => False

bool([]) # => False

bool({}) # => False

bool(()) # => False

除了上面這些值以外的所有值傳入都會(huì)得到True。

變量與集合

輸入輸出

Python當(dāng)中的標(biāo)準(zhǔn)輸入輸出是input和print。

print會(huì)輸出一個(gè)字符串,如果傳入的不是字符串會(huì)自動(dòng)調(diào)用__str__方法轉(zhuǎn)成字符串進(jìn)行輸出。默認(rèn)輸出會(huì)自動(dòng)換行,如果想要以不同的字符結(jié)尾代替換行,可以傳入end參數(shù):

# Python has a print function

print("I'm Python. Nice to meet you!") # => I'm Python. Nice to meet you!

# By default the print function also prints out a newline at the end.

# Use the optional argument end to change the end string.

print("Hello, World", end="!") # => Hello, World!

使用input時(shí),Python會(huì)在命令行接收一行字符串作為輸入。可以在input當(dāng)中傳入字符串,會(huì)被當(dāng)成提示輸出:

# Simple way to get input data from console

input_string_var = input("Enter some data: ") # Returns the data as a string

# Note: In earlier versions of Python, input() method was named as raw_input()

變量

Python中聲明對(duì)象不需要帶上類型,直接賦值即可,Python會(huì)自動(dòng)關(guān)聯(lián)類型,如果我們使用之前沒有聲明過的變量則會(huì)出發(fā)NameError異常。

# There are no declarations, only assignments.

# Convention is to use lower_case_with_underscores

some_var = 5

some_var # => 5

# Accessing a previously unassigned variable is an exception.

# See Control Flow to learn more about exception handling.

some_unknown_var # Raises a NameError

Python支持三元表達(dá)式,但是語法和C++不同,使用if else結(jié)構(gòu),寫成:

# if can be used as an expression

# Equivalent of C's '?:' ternary operator

"yahoo!" if 3 > 2 else 2 # => "yahoo!"

上段代碼等價(jià)于:

if 3 > 2:

return 'yahoo'

else:

return 2

list

Python中用[]表示空的list,我們也可以直接在其中填充元素進(jìn)行初始化:

# Lists store sequences

li = []

# You can start with a prefilled list

other_li = [4, 5, 6]

使用append和pop可以在list的末尾插入或者刪除元素:

# Add stuff to the end of a list with append

li.append(1) # li is now [1]

li.append(2) # li is now [1, 2]

li.append(4) # li is now [1, 2, 4]

li.append(3) # li is now [1, 2, 4, 3]

# Remove from the end with pop

li.pop() # => 3 and li is now [1, 2, 4]

# Let's put it back

li.append(3) # li is now [1, 2, 4, 3] again.

list可以通過[]加上下標(biāo)訪問指定位置的元素,如果是負(fù)數(shù),則表示倒序訪問。-1表示最后一個(gè)元素,-2表示倒數(shù)第二個(gè),以此類推。如果訪問的元素超過數(shù)組長(zhǎng)度,則會(huì)出發(fā)IndexError的錯(cuò)誤。

# Access a list like you would any array

li[0] # => 1

# Look at the last element

li[-1] # => 3

# Looking out of bounds is an IndexError

li[4] # Raises an IndexError

list支持切片操作,所謂的切片則是從原list當(dāng)中拷貝出指定的一段。我們用start: end的格式來獲取切片,注意,這是一個(gè)左閉右開區(qū)間。如果留空表示全部獲取,我們也可以額外再加入一個(gè)參數(shù)表示步長(zhǎng),比如[1:5:2]表示從1號(hào)位置開始,步長(zhǎng)為2獲取元素。得到的結(jié)果為[1, 3]。如果步長(zhǎng)設(shè)置成-1則代表反向遍歷。

# You can look at ranges with slice syntax.

# The start index is included, the end index is not

# (It's a closed/open range for you mathy types.)

li[1:3] # Return list from index 1 to 3 => [2, 4]

li[2:] # Return list starting from index 2 => [4, 3]

li[:3] # Return list from beginning until index 3 => [1, 2, 4]

li[::2] # Return list selecting every second entry => [1, 4]

li[::-1] # Return list in reverse order => [3, 4, 2, 1]

# Use any combination of these to make advanced slices

# li[start:end:step]

如果我們要指定一段區(qū)間倒序,則前面的start和end也需要反過來,例如我想要獲取[3: 6]區(qū)間的倒序,應(yīng)該寫成[6:3:-1]。

只寫一個(gè):,表示全部拷貝,如果用is判斷拷貝前后的list會(huì)得到False。可以使用del刪除指定位置的元素,或者可以使用remove方法。

# Make a one layer deep copy using slices

li2 = li[:] # => li2 = [1, 2, 4, 3] but (li2 is li) will result in false.

# Remove arbitrary elements from a list with "del"

del li[2] # li is now [1, 2, 3]

# Remove first occurrence of a value

li.remove(2) # li is now [1, 3]

li.remove(2) # Raises a ValueError as 2 is not in the list

insert方法可以指定位置插入元素,index方法可以查詢某個(gè)元素第一次出現(xiàn)的下標(biāo)。

# Insert an element at a specific index

li.insert(1, 2) # li is now [1, 2, 3] again

# Get the index of the first item found matching the argument

li.index(2) # => 1

li.index(4) # Raises a ValueError as 4 is not in the list

list可以進(jìn)行加法運(yùn)算,兩個(gè)list相加表示list當(dāng)中的元素合并。等價(jià)于使用extend方法:

# You can add lists

# Note: values for li and for other_li are not modified.

li + other_li # => [1, 2, 3, 4, 5, 6]

# Concatenate lists with "extend()"

li.extend(other_li) # Now li is [1, 2, 3, 4, 5, 6]

我們想要判斷元素是否在list中出現(xiàn),可以使用in關(guān)鍵字,通過使用len計(jì)算list的長(zhǎng)度:

# Check for existence in a list with "in"

1 in li # => True

# Examine the length with "len()"

len(li) # => 6

tuple

tuple和list非常接近,tuple通過()初始化。和list不同,tuple是不可變對(duì)象。也就是說tuple一旦生成不可以改變。如果我們修改tuple,會(huì)引發(fā)TypeError異常。

# Tuples are like lists but are immutable.

tup = (1, 2, 3)

tup[0] # => 1

tup[0] = 3 # Raises a TypeError

由于小括號(hào)是有改變優(yōu)先級(jí)的含義,所以我們定義單個(gè)元素的tuple,末尾必須加上逗號(hào),否則會(huì)被當(dāng)成是單個(gè)元素:

# Note that a tuple of length one has to have a comma after the last element but

# tuples of other lengths, even zero, do not.

type((1)) # =>

type((1,)) # =>

type(()) # =>

tuple支持list當(dāng)中絕大部分操作:

# You can do most of the list operations on tuples too

len(tup) # => 3

tup + (4, 5, 6) # => (1, 2, 3, 4, 5, 6)

tup[:2] # => (1, 2)

2 in tup # => True

我們可以用多個(gè)變量來解壓一個(gè)tuple:

# You can unpack tuples (or lists) into variables

a, b, c = (1, 2, 3) # a is now 1, b is now 2 and c is now 3

# You can also do extended unpacking

a, *b, c = (1, 2, 3, 4) # a is now 1, b is now [2, 3] and c is now 4

# Tuples are created by default if you leave out the parentheses

d, e, f = 4, 5, 6 # tuple 4, 5, 6 is unpacked into variables d, e and f

# respectively such that d = 4, e = 5 and f = 6

# Now look how easy it is to swap two values

e, d = d, e # d is now 5 and e is now 4

解釋一下這行代碼:

a, *b, c = (1, 2, 3, 4) # a is now 1, b is now [2, 3] and c is now 4

我們?cè)赽的前面加上了星號(hào),表示這是一個(gè)list。所以Python會(huì)在將其他變量對(duì)應(yīng)上值的情況下,將剩下的元素都賦值給b。

補(bǔ)充一點(diǎn),tuple本身雖然是不可變的,但是tuple當(dāng)中的可變?cè)厥强梢愿淖兊摹1热缥覀冇羞@樣一個(gè)tuple:

a = (3, [4])

我們雖然不能往a當(dāng)中添加或者刪除元素,但是a當(dāng)中含有一個(gè)list,我們可以改變這個(gè)list類型的元素,這并不會(huì)觸發(fā)tuple的異常:

a[1].append(0) # 這是合法的

dict

dict也是Python當(dāng)中經(jīng)常使用的容器,它等價(jià)于C++當(dāng)中的map,即存儲(chǔ)key和value的鍵值對(duì)。我們用{}表示一個(gè)dict,用:分隔key和value。

# Dictionaries store mappings from keys to values

empty_dict = {}

# Here is a prefilled dictionary

filled_dict = {"one": 1, "two": 2, "three": 3}

dict的key必須為不可變對(duì)象,所以list、set和dict不可以作為另一個(gè)dict的key,否則會(huì)拋出異常:

# Note keys for dictionaries have to be immutable types. This is to ensure that

# the key can be converted to a constant hash value for quick look-ups.

# Immutable types include ints, floats, strings, tuples.

invalid_dict = {[1,2,3]: "123"} # => Raises a TypeError: unhashable type: 'list'

valid_dict = {(1,2,3):[1,2,3]} # Values can be of any type, however.

我們同樣用[]查找dict當(dāng)中的元素,我們傳入key,獲得value,等價(jià)于get方法。

# Look up values with []

filled_dict["one"] # => 1

filled_dict.get('one') #=> 1

我們可以call dict當(dāng)中的keys和values方法,獲取dict當(dāng)中的所有key和value的集合,會(huì)得到一個(gè)list。在Python3.7以下版本當(dāng)中,返回的結(jié)果的順序可能和插入順序不同,在Python3.7及以上版本中,Python會(huì)保證返回的順序和插入順序一致:

# Get all keys as an iterable with "keys()". We need to wrap the call in list()

# to turn it into a list. We'll talk about those later. Note - for Python

# versions <3.7, dictionary key ordering is not guaranteed. Your results might

# not match the example below exactly. However, as of Python 3.7, dictionary

# items maintain the order at which they are inserted into the dictionary.

list(filled_dict.keys()) # => ["three", "two", "one"] in Python <3.7

list(filled_dict.keys()) # => ["one", "two", "three"] in Python 3.7+

# Get all values as an iterable with "values()". Once again we need to wrap it

# in list() to get it out of the iterable. Note - Same as above regarding key

# ordering.

list(filled_dict.values()) # => [3, 2, 1] in Python <3.7

list(filled_dict.values()) # => [1, 2, 3] in Python 3.7+

我們也可以用in判斷一個(gè)key是否在dict當(dāng)中,注意只能判斷key。

# Check for existence of keys in a dictionary with "in"

"one" in filled_dict # => True

1 in filled_dict # => False

如果使用[]查找不存在的key,會(huì)引發(fā)KeyError的異常。如果使用get方法則不會(huì)引起異常,只會(huì)得到一個(gè)None:

# Looking up a non-existing key is a KeyError

filled_dict["four"] # KeyError

# Use "get()" method to avoid the KeyError

filled_dict.get("one") # => 1

filled_dict.get("four") # => None

# The get method supports a default argument when the value is missing

filled_dict.get("one", 4) # => 1

filled_dict.get("four", 4) # => 4

setdefault方法可以為不存在的key插入一個(gè)value,如果key已經(jīng)存在,則不會(huì)覆蓋它:

# "setdefault()" inserts into a dictionary only if the given key isn't present

filled_dict.setdefault("five", 5) # filled_dict["five"] is set to 5

filled_dict.setdefault("five", 6) # filled_dict["five"] is still 5

我們可以使用update方法用另外一個(gè)dict來更新當(dāng)前dict,比如a.update(b)。對(duì)于a和b交集的key會(huì)被b覆蓋,a當(dāng)中不存在的key會(huì)被插入進(jìn)來:

# Adding to a dictionary

filled_dict.update({"four":4}) # => {"one": 1, "two": 2, "three": 3, "four": 4}

filled_dict["four"] = 4 # another way to add to dict

我們一樣可以使用del刪除dict當(dāng)中的元素,同樣只能傳入key。

Python3.5以上的版本支持使用**來解壓一個(gè)dict:

{'a': 1, **{'b': 2}} # => {'a': 1, 'b': 2}

{'a': 1, **{'a': 2}} # => {'a': 2}

set

set是用來存儲(chǔ)不重復(fù)元素的容器,當(dāng)中的元素都是不同的,相同的元素會(huì)被刪除。我們可以通過set(),或者通過{}來進(jìn)行初始化。注意當(dāng)我們使用{}的時(shí)候,必須要傳入數(shù)據(jù),否則Python會(huì)將它和dict弄混。

# Sets store ... well sets

empty_set = set()

# Initialize a set with a bunch of values. Yeah, it looks a bit like a dict. Sorry.

some_set = {1, 1, 2, 2, 3, 4} # some_set is now {1, 2, 3, 4}

set當(dāng)中的元素也必須是不可變對(duì)象,因此list不能傳入set。

# Similar to keys of a dictionary, elements of a set have to be immutable.

invalid_set = {[1], 1} # => Raises a TypeError: unhashable type: 'list'

valid_set = {(1,), 1}

可以調(diào)用add方法為set插入元素:

# Add one more item to the set

filled_set = some_set

filled_set.add(5) # filled_set is now {1, 2, 3, 4, 5}

# Sets do not have duplicate elements

filled_set.add(5) # it remains as before {1, 2, 3, 4, 5}

set還可以被認(rèn)為是集合,所以它還支持一些集合交叉并補(bǔ)的操作。

# Do set intersection with &

# 計(jì)算交集

other_set = {3, 4, 5, 6}

filled_set & other_set # => {3, 4, 5}

# Do set union with |

# 計(jì)算并集

filled_set | other_set # => {1, 2, 3, 4, 5, 6}

# Do set difference with -

# 計(jì)算差集

{1, 2, 3, 4} - {2, 3, 5} # => {1, 4}

# Do set symmetric difference with ^

# 這個(gè)有點(diǎn)特殊,計(jì)算對(duì)稱集,也就是去掉重復(fù)元素剩下的內(nèi)容

{1, 2, 3, 4} ^ {2, 3, 5} # => {1, 4, 5}

set還支持超集和子集的判斷,我們可以用大于等于和小于等于號(hào)判斷一個(gè)set是不是另一個(gè)的超集或子集:

# Check if set on the left is a superset of set on the right

{1, 2} >= {1, 2, 3} # => False

# Check if set on the left is a subset of set on the right

{1, 2} <= {1, 2, 3} # => True

和dict一樣,我們可以使用in判斷元素在不在set當(dāng)中。用copy可以拷貝一個(gè)set。

# Check for existence in a set with in

2 in filled_set # => True

10 in filled_set # => False

# Make a one layer deep copy

filled_set = some_set.copy() # filled_set is {1, 2, 3, 4, 5}

filled_set is some_set # => False

控制流和迭代

判斷語句

Python當(dāng)中的判斷語句非常簡(jiǎn)單,并且Python不支持switch,所以即使是多個(gè)條件,我們也只能羅列if-else。

# Let's just make a variable

some_var = 5

# Here is an if statement. Indentation is significant in Python!

# Convention is to use four spaces, not tabs.

# This prints "some_var is smaller than 10"

if some_var > 10:

print("some_var is totally bigger than 10.")

elif some_var < 10: # This elif clause is optional.

print("some_var is smaller than 10.")

else: # This is optional too.

print("some_var is indeed 10.")

循環(huán)

我們可以用in來循環(huán)迭代一個(gè)list當(dāng)中的內(nèi)容,這也是Python當(dāng)中基本的循環(huán)方式。

"""

For loops iterate over lists

prints:

dog is a mammal

cat is a mammal

mouse is a mammal

"""

for animal in ["dog", "cat", "mouse"]:

# You can use format() to interpolate formatted strings

print("{} is a mammal".format(animal))

如果我們要循環(huán)一個(gè)范圍,可以使用range。range加上一個(gè)參數(shù)表示從0開始的序列,比如range(10),表示[0, 10)區(qū)間內(nèi)的所有整數(shù):

"""

"range(number)" returns an iterable of numbers

from zero to the given number

prints:

0

1

2

3

"""

for i in range(4):

print(i)

如果我們傳入兩個(gè)參數(shù),則代表迭代區(qū)間的首尾。

"""

"range(lower, upper)" returns an iterable of numbers

from the lower number to the upper number

prints:

4

5

6

7

"""

for i in range(4, 8):

print(i)

如果我們傳入第三個(gè)元素,表示每次循環(huán)變量自增的步長(zhǎng)。

"""

"range(lower, upper, step)" returns an iterable of numbers

from the lower number to the upper number, while incrementing

by step. If step is not indicated, the default value is 1.

prints:

4

6

"""

for i in range(4, 8, 2):

print(i)

如果使用enumerate函數(shù),可以同時(shí)迭代一個(gè)list的下標(biāo)和元素:

"""

To loop over a list, and retrieve both the index and the value of each item in the list

prints:

0 dog

1 cat

2 mouse

"""

animals = ["dog", "cat", "mouse"]

for i, value in enumerate(animals):

print(i, value)

while循環(huán)和C++類似,當(dāng)條件為True時(shí)執(zhí)行,為false時(shí)退出。并且判斷條件不需要加上括號(hào):

"""

While loops go until a condition is no longer met.

prints:

0

1

2

3

"""

x = 0

while x < 4:

print(x)

x += 1 # Shorthand for x = x + 1

捕獲異常

Python當(dāng)中使用try和except捕獲異常,我們可以在except后面限制異常的類型。如果有多個(gè)類型可以寫多個(gè)except,還可以使用else語句表示其他所有的類型。finally語句內(nèi)的語法無論是否會(huì)觸發(fā)異常都必定執(zhí)行:

# Handle exceptions with a try/except block

try:

# Use "raise" to raise an error

raise IndexError("This is an index error")

except IndexError as e:

pass # Pass is just a no-op. Usually you would do recovery here.

except (TypeError, NameError):

pass # Multiple exceptions can be handled together, if required.

else: # Optional clause to the try/except block. Must follow all except blocks

print("All good!") # Runs only if the code in try raises no exceptions

finally: # Execute under all circumstances

print("We can clean up resources here")

with操作

在Python當(dāng)中我們經(jīng)常會(huì)使用資源,最常見的就是open打開一個(gè)文件。我們打開了文件句柄就一定要關(guān)閉,但是如果我們手動(dòng)來編碼,經(jīng)常會(huì)忘記執(zhí)行close操作。并且如果文件異常,還會(huì)觸發(fā)異常。這個(gè)時(shí)候我們可以使用with語句來代替這部分處理,使用with會(huì)自動(dòng)在with塊執(zhí)行結(jié)束或者是觸發(fā)異常時(shí)關(guān)閉打開的資源。

以下是with的幾種用法和功能:

# Instead of try/finally to cleanup resources you can use a with statement

# 代替使用try/finally語句來關(guān)閉資源

with open("myfile.txt") as f:

for line in f:

print(line)

# Writing to a file

# 使用with寫入文件

contents = {"aa": 12, "bb": 21}

with open("myfile1.txt", "w+") as file:

file.write(str(contents)) # writes a string to a file

with open("myfile2.txt", "w+") as file:

file.write(json.dumps(contents)) # writes an object to a file

# Reading from a file

# 使用with讀取文件

with open('myfile1.txt', "r+") as file:

contents = file.read() # reads a string from a file

print(contents)

# print: {"aa": 12, "bb": 21}

with open('myfile2.txt', "r+") as file:

contents = json.load(file) # reads a json object from a file

print(contents)

# print: {"aa": 12, "bb": 21}

可迭代對(duì)象

凡是可以使用in語句來迭代的對(duì)象都叫做可迭代對(duì)象,它和迭代器不是一個(gè)含義。這里只有可迭代對(duì)象的介紹,想要了解迭代器的具體內(nèi)容,請(qǐng)移步傳送門:

當(dāng)我們調(diào)用dict當(dāng)中的keys方法的時(shí)候,返回的結(jié)果就是一個(gè)可迭代對(duì)象。

# Python offers a fundamental abstraction called the Iterable.

# An iterable is an object that can be treated as a sequence.

# The object returned by the range function, is an iterable.

filled_dict = {"one": 1, "two": 2, "three": 3}

our_iterable = filled_dict.keys()

print(our_iterable) # => dict_keys(['one', 'two', 'three']). This is an object that implements our Iterable interface.

# We can loop over it.

for i in our_iterable:

print(i) # Prints one, two, three

我們不能使用下標(biāo)來訪問可迭代對(duì)象,但我們可以用iter將它轉(zhuǎn)化成迭代器,使用next關(guān)鍵字來獲取下一個(gè)元素。也可以將它轉(zhuǎn)化成list類型,變成一個(gè)list。

# However we cannot address elements by index.

our_iterable[1] # Raises a TypeError

# An iterable is an object that knows how to create an iterator.

our_iterator = iter(our_iterable)

# Our iterator is an object that can remember the state as we traverse through it.

# We get the next object with "next()".

next(our_iterator) # => "one"

# It maintains state as we iterate.

next(our_iterator) # => "two"

next(our_iterator) # => "three"

# After the iterator has returned all of its data, it raises a StopIteration exception

next(our_iterator) # Raises StopIteration

# We can also loop over it, in fact, "for" does this implicitly!

our_iterator = iter(our_iterable)

for i in our_iterator:

print(i) # Prints one, two, three

# You can grab all the elements of an iterable or iterator by calling list() on it.

list(our_iterable) # => Returns ["one", "two", "three"]

list(our_iterator) # => Returns [] because state is saved

函數(shù)

使用def關(guān)鍵字來定義函數(shù),我們?cè)趥鲄⒌臅r(shí)候如果指定函數(shù)內(nèi)的參數(shù)名,可以不按照函數(shù)定義的順序傳參:

# Use "def" to create new functions

def add(x, y):

print("x is {} and y is {}".format(x, y))

return x + y # Return values with a return statement

# Calling functions with parameters

add(5, 6) # => prints out "x is 5 and y is 6" and returns 11

# Another way to call functions is with keyword arguments

add(y=6, x=5) # Keyword arguments can arrive in any order.

可以在參數(shù)名之前加上*表示任意長(zhǎng)度的參數(shù),參數(shù)會(huì)被轉(zhuǎn)化成list:

# You can define functions that take a variable number of

# positional arguments

def varargs(*args):

return args

varargs(1, 2, 3) # => (1, 2, 3)

也可以指定任意長(zhǎng)度的關(guān)鍵字參數(shù),在參數(shù)前加上**表示接受一個(gè)dict:

# You can define functions that take a variable number of

# keyword arguments, as well

def keyword_args(**kwargs):

return kwargs

# Let's call it to see what happens

keyword_args(big="foot", loch="ness") # => {"big": "foot", "loch": "ness"}

當(dāng)然我們也可以兩個(gè)都用上,這樣可以接受任何參數(shù):

# You can do both at once, if you like

def all_the_args(*args, **kwargs):

print(args)

print(kwargs)

"""

all_the_args(1, 2, a=3, b=4) prints:

(1, 2)

{"a": 3, "b": 4}

"""

傳入?yún)?shù)的時(shí)候我們也可以使用*和**來解壓list或者是dict:

# When calling functions, you can do the opposite of args/kwargs!

# Use * to expand tuples and use ** to expand kwargs.

args = (1, 2, 3, 4)

kwargs = {"a": 3, "b": 4}

all_the_args(*args) # equivalent to all_the_args(1, 2, 3, 4)

all_the_args(**kwargs) # equivalent to all_the_args(a=3, b=4)

all_the_args(*args, **kwargs) # equivalent to all_the_args(1, 2, 3, 4, a=3, b=4)

Python中的參數(shù)可以返回多個(gè)值:

# Returning multiple values (with tuple assignments)

def swap(x, y):

return y, x # Return multiple values as a tuple without the parenthesis.

# (Note: parenthesis have been excluded but can be included)

x = 1

y = 2

x, y = swap(x, y) # => x = 2, y = 1

# (x, y) = swap(x,y) # Again parenthesis have been excluded but can be included.

函數(shù)內(nèi)部定義的變量即使和全局變量重名,也不會(huì)覆蓋全局變量的值。想要在函數(shù)內(nèi)部使用全局變量,需要加上global關(guān)鍵字,表示這是一個(gè)全局變量:

# Function Scope

x = 5

def set_x(num):

# Local var x not the same as global variable x

x = num # => 43

print(x) # => 43

def set_global_x(num):

global x

print(x) # => 5

x = num # global var x is now set to 6

print(x) # => 6

set_x(43)

set_global_x(6)

Python支持函數(shù)式編程,我們可以在一個(gè)函數(shù)內(nèi)部返回一個(gè)函數(shù):

# Python has first class functions

def create_adder(x):

def adder(y):

return x + y

return adder

add_10 = create_adder(10)

add_10(3) # => 13

Python中可以使用lambda表示匿名函數(shù),使用:作為分隔,:前面表示匿名函數(shù)的參數(shù),:后面的是函數(shù)的返回值:

# There are also anonymous functions

(lambda x: x > 2)(3) # => True

(lambda x, y: x ** 2 + y ** 2)(2, 1) # => 5

我們還可以將函數(shù)作為參數(shù)使用map和filter,實(shí)現(xiàn)元素的批量處理和過濾。關(guān)于Python中map、reduce和filter的使用,具體可以查看之前的文章:

# There are built-in higher order functions

list(map(add_10, [1, 2, 3])) # => [11, 12, 13]

list(map(max, [1, 2, 3], [4, 2, 1])) # => [4, 2, 3]

list(filter(lambda x: x > 5, [3, 4, 5, 6, 7])) # => [6, 7]

我們還可以結(jié)合循環(huán)和判斷語來給list或者是dict進(jìn)行初始化:

# We can use list comprehensions for nice maps and filters

# List comprehension stores the output as a list which can itself be a nested list

[add_10(i) for i in [1, 2, 3]] # => [11, 12, 13]

[x for x in [3, 4, 5, 6, 7] if x > 5] # => [6, 7]

# You can construct set and dict comprehensions as well.

{x for x in 'abcddeef' if x not in 'abc'} # => {'d', 'e', 'f'}

{x: x**2 for x in range(5)} # => {0: 0, 1: 1, 2: 4, 3: 9, 4: 16}

模塊

使用import語句引入一個(gè)Python模塊,我們可以用.來訪問模塊中的函數(shù)或者是類。

# You can import modules

import math

print(math.sqrt(16)) # => 4.0

我們也可以使用from import的語句,單獨(dú)引入模塊內(nèi)的函數(shù)或者是類,而不再需要寫出完整路徑。使用from import *可以引入模塊內(nèi)所有內(nèi)容(不推薦這么干)

# You can get specific functions from a module

from math import ceil, floor

print(ceil(3.7)) # => 4.0

print(floor(3.7)) # => 3.0

# You can import all functions from a module.

# Warning: this is not recommended

from math import *

可以使用as給模塊內(nèi)的方法或者類起別名:

# You can shorten module names

import math as m

math.sqrt(16) == m.sqrt(16) # => True

我們可以使用dir查看我們用的模塊的路徑:

# You can find out which functions and attributes

# are defined in a module.

import math

dir(math)

這么做的原因是如果我們當(dāng)前的路徑下也有一個(gè)叫做math的Python文件,那么會(huì)覆蓋系統(tǒng)自帶的math的模塊。這是尤其需要注意的,不小心會(huì)導(dǎo)致很多奇怪的bug。

我們來看一個(gè)完整的類,相關(guān)的介紹都在注釋當(dāng)中

# We use the "class" statement to create a class

class Human:

# A class attribute. It is shared by all instances of this class

# 類屬性,可以直接通過Human.species調(diào)用,而不需要通過實(shí)例

species = "H. sapiens"

# Basic initializer, this is called when this class is instantiated.

# Note that the double leading and trailing underscores denote objects

# or attributes that are used by Python but that live in user-controlled

# namespaces. Methods(or objects or attributes) like: __init__, __str__,

# __repr__ etc. are called special methods (or sometimes called dunder methods)

# You should not invent such names on your own.

# 最基礎(chǔ)的構(gòu)造函數(shù)

# 加了下劃線的函數(shù)和變量表示不應(yīng)該被用戶使用,其中雙下劃線的函數(shù)或者是變量將不會(huì)被子類覆蓋

# 前后都有雙下劃線的函數(shù)和屬性是類當(dāng)中的特殊屬性

def __init__(self, name):

# Assign the argument to the instance's name attribute

self.name = name

# Initialize property

self._age = 0

# An instance method. All methods take "self" as the first argument

# 類中的函數(shù),所有實(shí)例可以調(diào)用,第一個(gè)參數(shù)必須是self

# self表示實(shí)例的引用

def say(self, msg):

print("{name}: {message}".format(name=self.name, message=msg))

# Another instance method

def sing(self):

return 'yo... yo... microphone check... one two... one two...'

# A class method is shared among all instances

# They are called with the calling class as the first argument

@classmethod

# 加上了注解,表示是類函數(shù)

# 通過Human.get_species來調(diào)用,所有實(shí)例共享

def get_species(cls):

return cls.species

# A static method is called without a class or instance reference

@staticmethod

# 靜態(tài)函數(shù),通過類名或者是實(shí)例都可以調(diào)用

def grunt():

return "*grunt*"

# A property is just like a getter.

# It turns the method age() into an read-only attribute of the same name.

# There's no need to write trivial getters and setters in Python, though.

@property

# property注解,類似于get,set方法

# 效率很低,除非必要,不要使用

def age(self):

return self._age

# This allows the property to be set

@age.setter

def age(self, age):

self._age = age

# This allows the property to be deleted

@age.deleter

def age(self):

del self._age

以上內(nèi)容的詳細(xì)介紹之前也有過相關(guān)文章,可以查看:

下面我們來看看Python當(dāng)中類的使用:

# When a Python interpreter reads a source file it executes all its code.

# This __name__ check makes sure this code block is only executed when this

# module is the main program.

# 這個(gè)是main函數(shù)也是整個(gè)程序入口的慣用寫法

if __name__ == '__main__':

# Instantiate a class

# 實(shí)例化一個(gè)類,獲取類的對(duì)象

i = Human(name="Ian")

# 執(zhí)行say方法

i.say("hi") # "Ian: hi"

j = Human("Joel")

j.say("hello") # "Joel: hello"

# i和j都是Human的實(shí)例,都稱作是Human類的對(duì)象

# i and j are instances of type Human, or in other words: they are Human objects

# Call our class method

# 類屬性被所有實(shí)例共享,一旦修改全部生效

i.say(i.get_species()) # "Ian: H. sapiens"

# Change the shared attribute

Human.species = "H. neanderthalensis"

i.say(i.get_species()) # => "Ian: H. neanderthalensis"

j.say(j.get_species()) # => "Joel: H. neanderthalensis"

# 通過類名調(diào)用靜態(tài)方法

# Call the static method

print(Human.grunt()) # => "*grunt*"

# Cannot call static method with instance of object

# because i.grunt() will automatically put "self" (the object i) as an argument

# 不能通過對(duì)象調(diào)用靜態(tài)方法,因?yàn)閷?duì)象會(huì)傳入self實(shí)例,會(huì)導(dǎo)致不匹配

print(i.grunt()) # => TypeError: grunt() takes 0 positional arguments but 1 was given

# Update the property for this instance

# 實(shí)例級(jí)別的屬性是獨(dú)立的,各個(gè)對(duì)象各自擁有,修改不會(huì)影響其他對(duì)象內(nèi)的值

i.age = 42

# Get the property

i.say(i.age) # => "Ian: 42"

j.say(j.age) # => "Joel: 0"

# Delete the property

del i.age

# i.age # => this would raise an AttributeError

這里解釋一下,實(shí)例和對(duì)象可以理解成一個(gè)概念,實(shí)例的英文是instance,對(duì)象的英文是object。都是指類經(jīng)過實(shí)例化之后得到的對(duì)象。

繼承

繼承可以讓子類繼承父類的變量以及方法,并且我們還可以在子類當(dāng)中指定一些屬于自己的特性,并且還可以重寫父類的一些方法。一般我們會(huì)將不同的類放在不同的文件當(dāng)中,使用import引入,一樣可以實(shí)現(xiàn)繼承。

from human import Human

# Specify the parent class(es) as parameters to the class definition

class Superhero(Human):

# If the child class should inherit all of the parent's definitions without

# any modifications, you can just use the "pass" keyword (and nothing else)

# but in this case it is commented out to allow for a unique child class:

# pass

# 如果要完全繼承父類的所有的實(shí)現(xiàn),我們可以使用關(guān)鍵字pass,表示跳過。這樣不會(huì)修改父類當(dāng)中的實(shí)現(xiàn)

# Child classes can override their parents' attributes

species = 'Superhuman'

# Children automatically inherit their parent class's constructor including

# its arguments, but can also define additional arguments or definitions

# and override its methods such as the class constructor.

# This constructor inherits the "name" argument from the "Human" class and

# adds the "superpower" and "movie" arguments:

# 子類會(huì)完全繼承父類的構(gòu)造方法,我們也可以進(jìn)行改造,比如額外增加一些參數(shù)

def __init__(self, name, movie=False,

superpowers=["super strength", "bulletproofing"]):

# add additional class attributes:

# 額外新增的參數(shù)

self.fictional = True

self.movie = movie

# be aware of mutable default values, since defaults are shared

self.superpowers = superpowers

# The "super" function lets you access the parent class's methods

# that are overridden by the child, in this case, the __init__ method.

# This calls the parent class constructor:

# 子類可以通過super關(guān)鍵字調(diào)用父類的方法

super().__init__(name)

# override the sing method

# 重寫父類的sing方法

def sing(self):

return 'Dun, dun, DUN!'

# add an additional instance method

# 新增方法,只屬于子類

def boast(self):

for power in self.superpowers:

print("I wield the power of {pow}!".format(pow=power))

if __name__ == '__main__':

sup = Superhero(name="Tick")

# Instance type checks

# 檢查繼承關(guān)系

if isinstance(sup, Human):

print('I am human')

# 檢查類型

if type(sup) is Superhero:

print('I am a superhero')

# Get the Method Resolution search Order used by both getattr() and super()

# This attribute is dynamic and can be updated

# 查看方法查詢的順序

# 先是自身,然后沿著繼承順序往上,最后到object

print(Superhero.__mro__) # => (,

# => , )

# 相同的屬性子類覆蓋了父類

# Calls parent method but uses its own class attribute

print(sup.get_species()) # => Superhuman

# Calls overridden method

# 相同的方法也覆蓋了父類

print(sup.sing()) # => Dun, dun, DUN!

# Calls method from Human

# 繼承了父類的方法

sup.say('Spoon') # => Tick: Spoon

# Call method that exists only in Superhero

# 子類特有的方法

sup.boast() # => I wield the power of super strength!

# => I wield the power of bulletproofing!

# Inherited class attribute

sup.age = 31

print(sup.age) # => 31

# Attribute that only exists within Superhero

print('Am I Oscar eligible? ' + str(sup.movie))

多繼承

我們創(chuàng)建一個(gè)蝙蝠類:

# Another class definition

# bat.py

class Bat:

species = 'Baty'

def __init__(self, can_fly=True):

self.fly = can_fly

# This class also has a say method

def say(self, msg):

msg = '... ... ...'

return msg

# And its own method as well

# 蝙蝠獨(dú)有的聲吶方法

def sonar(self):

return '))) ... ((('

if __name__ == '__main__':

b = Bat()

print(b.say('hello'))

print(b.fly)

我們?cè)賱?chuàng)建一個(gè)蝙蝠俠的類,同時(shí)繼承Superhero和Bat:

# And yet another class definition that inherits from Superhero and Bat

# superhero.py

from superhero import Superhero

from bat import Bat

# Define Batman as a child that inherits from both Superhero and Bat

class Batman(Superhero, Bat):

def __init__(self, *args, **kwargs):

# Typically to inherit attributes you have to call super:

# super(Batman, self).__init__(*args, **kwargs)

# However we are dealing with multiple inheritance here, and super()

# only works with the next base class in the MRO list.

# So instead we explicitly call __init__ for all ancestors.

# The use of *args and **kwargs allows for a clean way to pass arguments,

# with each parent "peeling a layer of the onion".

# 通過類名調(diào)用兩個(gè)父類各自的構(gòu)造方法

Superhero.__init__(self, 'anonymous', movie=True,

superpowers=['Wealthy'], *args, **kwargs)

Bat.__init__(self, *args, can_fly=False, **kwargs)

# override the value for the name attribute

self.name = 'Sad Affleck'

# 重寫父類的sing方法

def sing(self):

return 'nan nan nan nan nan batman!'

執(zhí)行這個(gè)類:

if __name__ == '__main__':

sup = Batman()

# Get the Method Resolution search Order used by both getattr() and super().

# This attribute is dynamic and can be updated

# 可以看到方法查詢的順序是先沿著superhero這條線到human,然后才是bat

print(Batman.__mro__) # => (,

# => ,

# => ,

# => , )

# Calls parent method but uses its own class attribute

# 只有superhero有g(shù)et_species方法

print(sup.get_species()) # => Superhuman

# Calls overridden method

print(sup.sing()) # => nan nan nan nan nan batman!

# Calls method from Human, because inheritance order matters

sup.say('I agree') # => Sad Affleck: I agree

# Call method that exists only in 2nd ancestor

# 調(diào)用蝙蝠類的聲吶方法

print(sup.sonar()) # => ))) ... (((

# Inherited class attribute

sup.age = 100

print(sup.age) # => 100

# Inherited attribute from 2nd ancestor whose default value was overridden.

print('Can I fly? ' + str(sup.fly)) # => Can I fly? False

進(jìn)階

生成器

我們可以通過yield關(guān)鍵字創(chuàng)建一個(gè)生成器,每次我們調(diào)用的時(shí)候執(zhí)行到y(tǒng)ield關(guān)鍵字處則停止。下次再次調(diào)用則還是從yield處開始往下執(zhí)行:

# Generators help you make lazy code.

def double_numbers(iterable):

for i in iterable:

yield i + i

# Generators are memory-efficient because they only load the data needed to

# process the next value in the iterable. This allows them to perform

# operations on otherwise prohibitively large value ranges.

# NOTE: `range` replaces `xrange` in Python 3.

for i in double_numbers(range(1, 900000000)): # `range` is a generator.

print(i)

if i >= 30:

break

除了yield之外,我們還可以使用()小括號(hào)來生成一個(gè)生成器:

# Just as you can create a list comprehension, you can create generator

# comprehensions as well.

values = (-x for x in [1,2,3,4,5])

for x in values:

print(x) # prints -1 -2 -3 -4 -5 to console/terminal

# You can also cast a generator comprehension directly to a list.

values = (-x for x in [1,2,3,4,5])

gen_to_list = list(values)

print(gen_to_list) # => [-1, -2, -3, -4, -5]

關(guān)于生成器和迭代器更多的內(nèi)容,可以查看下面這篇文章:

裝飾器

我們引入functools當(dāng)中的wraps之后,可以創(chuàng)建一個(gè)裝飾器。裝飾器可以在不修改函數(shù)內(nèi)部代碼的前提下,在外面包裝一層其他的邏輯:

# Decorators

# In this example `beg` wraps `say`. If say_please is True then it

# will change the returned message.

from functools import wraps

def beg(target_function):

@wraps(target_function)

# 如果please為True,額外輸出一句Please! I am poor :(

def wrapper(*args, **kwargs):

msg, say_please = target_function(*args, **kwargs)

if say_please:

return "{} {}".format(msg, "Please! I am poor :(")

return msg

return wrapper

@beg

def say(say_please=False):

msg = "Can you buy me a beer?"

return msg, say_please

print(say()) # Can you buy me a beer?

print(say(say_please=True)) # Can you buy me a beer? Please! I am poor :(

裝飾器之前也有專門的文章詳細(xì)介紹,可以移步下面的傳送門:

結(jié)尾

不知道有多少小伙伴可以看到結(jié)束,原作者的確非常厲害,把Python的基本操作基本上都囊括在里面了。如果都能讀懂并且理解的話,那么Python這門語言就算是入門了。

原作者寫的是一個(gè)Python文件,所有的內(nèi)容都在Python的注釋當(dāng)中。我在它的基礎(chǔ)上做了修補(bǔ)和額外的描述。如果想要獲得原文,可以點(diǎn)擊查看原文,或者是在公眾號(hào)內(nèi)回復(fù)learnpython獲取。

如果你之前就有其他語言的語言基礎(chǔ),我想本文讀完應(yīng)該不用30分鐘。當(dāng)然在30分鐘內(nèi)學(xué)會(huì)一門語言是不可能的,也不是我所提倡的。但至少通過本文我們可以做到熟悉Python的語法,知道大概有哪些操作,剩下的就要我們親自去寫代碼的時(shí)候去體會(huì)和運(yùn)用了。

根據(jù)我的經(jīng)驗(yàn),在學(xué)習(xí)一門新語言的前期,不停地查閱資料是免不了的。希望本文可以作為你在使用Python時(shí)候的查閱文檔。

今天的文章就到這里,原創(chuàng)不易,需要你的一個(gè)關(guān)注,你的舉手之勞對(duì)我來說很重要。

總結(jié)

以上是生活随笔為你收集整理的有没有python的班_【万字长文】别再报班了,一篇文章带你入门Python的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。

av女优中文字幕在线观看 | 国产视频精品久久 | 一区二区三区免费在线播放 | 国产精品久久久久久69 | 91九色网站 | 天天操夜夜干 | 亚洲 欧美 成人 | 欧美一级片免费 | 亚洲最快最全在线视频 | 日日狠狠 | 91爱在线 | 在线播放91 | 中文字幕免费一区二区 | 国产a视频免费观看 | 超碰av在线播放 | 日韩欧美视频免费观看 | 四季av综合网站 | 麻豆精品在线视频 | 中文字幕欧美日韩va免费视频 | 青草视频在线 | 欧美三级高清 | 国产手机在线观看视频 | 高清不卡毛片 | 99精品在线 | 人人爽人人爽人人片av免 | 最近中文字幕mv | 亚洲天堂色婷婷 | 免费在线观看亚洲视频 | 91av手机在线观看 | a级国产乱理论片在线观看 伊人宗合网 | 亚洲激情影院 | 日韩国产高清在线 | 成人h在线观看 | 日韩婷婷| 在线视频 精品 | 国产五十路毛片 | 国产免费又黄又爽 | 久久艹久久 | 97电影在线 | 欧美一级免费 | 久久国产精品偷 | 国产激情小视频在线观看 | 91av免费观看| 中文字幕在线观看完整版电影 | 四虎永久免费 | 久久黄页 | 久久男人免费视频 | 嫩嫩影院理论片 | 日韩一区二区三区在线看 | 99久e精品热线免费 99国产精品久久久久久久久久 | 中文字幕av在线电影 | 精品久久久免费 | 狠狠狠狠狠色综合 | 中文字幕国产视频 | 中文字幕av在线电影 | 欧美色图亚洲图片 | 免费在线看v| 免费网址你懂的 | 夜夜夜夜爽 | 亚洲综合视频在线 | 日韩高清成人在线 | 麻豆视频免费在线播放 | av直接看| 色99在线 | 免费视频你懂得 | 久久国产网 | 国产视频在线一区二区 | 国产高清免费观看 | 成人中文字幕+乱码+中文字幕 | 西西大胆免费视频 | 亚洲精品国产精品乱码在线观看 | 久久电影色 | 在线观看免费观看在线91 | 久久在线精品 | 成人小视频在线观看免费 | 欧美日韩免费视频 | 国产精品免费在线播放 | 六月天色婷婷 | av在线超碰 | 国产又粗又猛又爽又黄的视频先 | 黄色av大片| 黄色特一级片 | 九九久久国产精品 | 97综合视频 | 亚洲精品在线播放视频 | www.com在线观看| 国产成人精品999 | 在线免费观看黄色 | 中日韩三级视频 | 九九热视频在线免费观看 | 国产免费视频在线 | 在线视频 影院 | 国产成人在线综合 | 97成人精品区在线播放 | 中文字幕刺激在线 | 麻豆视频在线免费 | 成年人在线观看网站 | 国产精品欧美久久久久三级 | 午夜精品999 | 成人av免费在线看 | 91在线观看视频网站 | 午夜视频久久久 | 国产在线播放不卡 | 国产一级二级在线播放 | www.久久色 | 天天操天天色天天射 | 国产在线精品福利 | 在线播放你懂 | www天天操 | 在线播放亚洲 | 国产91在线观看 | 欧美国产日韩激情 | 国产在线观看99 | 天天操天天射天天插 | www天天干com | 亚洲精品国久久99热 | 91视频免费看| 亚洲视屏一区 | www色网站 | 99久久久国产精品 | 中文字幕在线不卡国产视频 | 久久久久久久久久久久久久免费看 | 久久精品79国产精品 | 在线视频一区二区 | 国产视频一区二区在线 | 午夜久久久久久久久久久 | www.黄色小说.com| 色婷婷在线视频 | 国产精品久久久久久久久久免费 | 国产精品一区二区精品视频免费看 | 午夜在线免费观看 | 97视频入口免费观看 | 色综合久久久久综合体 | 国产精品手机播放 | 91精品国产福利在线观看 | 99热只有精品在线观看 | 久久精品欧美一区二区三区麻豆 | 久久人人爽av | 亚洲欧洲一区二区在线观看 | 日韩和的一区二在线 | 欧美精品国产综合久久 | 久久精品视频在线观看免费 | 久久手机免费视频 | 91在线免费观看国产 | 日韩电影一区二区三区在线观看 | 午夜色站 | 免费黄色在线 | 成人精品99 | 伊人久操| 免费在线观看污网站 | 久久国产精品电影 | 国产伦精品一区二区三区照片91 | 亚洲精品一区二区18漫画 | 天天天在线综合网 | 精品久久久久久国产91 | 日本中文字幕免费观看 | 中文在线字幕免费观看 | 色婷婷a | 丝袜美女视频网站 | 久久久免费精品视频 | 国产91全国探花系列在线播放 | 9ⅰ精品久久久久久久久中文字幕 | 九九热久久免费视频 | 国产美女永久免费 | 免费在线观看成人小视频 | 国产女人18毛片水真多18精品 | 少妇自拍av| 不卡的av | 久久久久久久久毛片 | 国产 日韩 在线 亚洲 字幕 中文 | 成年人视频免费在线 | av综合av| 免费观看丰满少妇做爰 | 国产亚洲精品久久久久久移动网络 | 欧美日韩一区二区三区免费视频 | jizz欧美性9 国产一区高清在线观看 | 欧美大片在线观看一区 | 久久视频这里只有精品 | 四虎影视成人永久免费观看视频 | 色88久久 | 91黄在线看 | 国产日韩在线播放 | 久久久久久久久久毛片 | 国产精品手机在线 | 97在线观看免费观看高清 | www.福利 | 久久免费视频国产 | 在线观看视频99 | 在线视频手机国产 | 成人h电影在线观看 | 日韩一区二区三区高清在线观看 | 一区二区精品视频 | 伊人激情综合 | 在线观看网站av | 久久综合网色—综合色88 | 中文电影网 | 这里有精品在线视频 | 国产视频2| 波多野结衣电影久久 | 日韩免费在线观看视频 | 91亚·色 | 亚州国产视频 | 97免费在线观看 | 99精彩视频在线观看免费 | 岛国av在线不卡 | 国产午夜一级毛片 | 不卡的av电影在线观看 | 久久综合久久综合久久 | 国产第一页在线观看 | 亚洲综合丁香 | 久久久久欧美精品 | 国产成人精品一区二三区 | 国产精品日韩久久久久 | 久久久网址| 日本中文字幕免费观看 | 欧美资源在线观看 | 四虎在线视频免费观看 | 亚洲精品免费在线播放 | 91原创在线观看 | 午夜12点 | 五月香视频在线观看 | 日韩av成人在线观看 | 精品一区二区在线免费观看 | 午夜三级理论 | 在线激情影院一区 | 亚洲成年人在线播放 | 中文字幕av电影下载 | 国产99久久精品一区二区300 | 黄色大片日本免费大片 | 五月天狠狠操 | 深爱激情亚洲 | 天天曰天天爽 | 菠萝菠萝在线精品视频 | 免费在线黄网 | 色婷婷福利 | 国产精品亚州 | 99国产成+人+综合+亚洲 欧美 | 国产视频在线看 | 免费国产在线精品 | 4438全国亚洲精品在线观看视频 | 色国产视频 | 在线影院 国内精品 | 成人av一区二区在线观看 | 成年人免费在线观看网站 | 午夜在线看片 | 亚洲婷婷在线视频 | 婷婷色 亚洲 | 免费91麻豆精品国产自产在线观看 | 4p变态网欧美系列 | 草久久av | 国产在线污 | 青青射 | 欧美性高跟鞋xxxxhd | 91九色网址 | 一本—道久久a久久精品蜜桃 | 五月的婷婷 | 久久理论片| 91香蕉视频好色先生 | 久久国产精品影片 | 国产一区视频免费在线观看 | 99爱国产精品 | 99精品欧美一区二区三区 | 久久精品79国产精品 | 在线观看免费版高清版 | 综合久久久久久久久 | 亚洲成人资源在线观看 | 成人中文字幕av | 日本午夜在线观看 | 在线激情网 | 国内精品视频一区二区三区八戒 | 热热热热热色 | 久久久久久久久久久网 | 亚洲九九 | 97精品久久人人爽人人爽 | 中文字幕 国产视频 | 国产精品欧美久久久久天天影视 | 99久久99视频只有精品 | 日韩精品影视 | 国产在线色 | 免费观看性生活大片3 | 夜夜操天天干 | 四虎8848免费高清在线观看 | 五月婷婷开心中文字幕 | 婷婷激情小说网 | 在线播放 日韩专区 | 亚洲精品高清视频在线观看 | 精品一二| 久草五月 | 四虎成人精品永久免费av | 深夜激情影院 | 日韩三级一区 | 激情综合国产 | 亚洲日本va午夜在线电影 | 欧美日韩国产在线精品 | 久草在线手机观看 | 国产高清av在线播放 | 亚洲精品中文字幕在线观看 | 九九精品无码 | 精品在线免费视频 | 中文字幕免费国产精品 | 精品久久久久久久久久久久久久久久 | 91豆麻精品91久久久久久 | 国产aaa免费视频 | 人人要人人澡人人爽人人dvd | 中文字幕日韩在线播放 | 中文字幕在线有码 | 天天爱天天射天天干天天 | 男女全黄一级一级高潮免费看 | 久久精品国产亚洲精品2020 | 天天弄天天操 | 精品国产aⅴ麻豆 | 久草在线免费看视频 | 黄色小网站免费看 | 久久美女电影 | 在线亚洲高清视频 | 国产精品无 | 国产免费又粗又猛又爽 | 三级毛片视频 | 色视频在线看 | 久艹视频在线免费观看 | 久久夜色精品国产欧美乱极品 | 久草视频精品 | 91污污视频在线观看 | 日日爽日日操 | 亚洲欧美视频一区二区三区 | 九色精品免费永久在线 | 欧美一区二区三区在线播放 | 国产无区一区二区三麻豆 | 久久这里有 | 国产91精品久久久久久 | 婷婷色伊人 | 久久久国产一区二区三区 | 免费看的黄色 | 亚洲三级毛片 | av中文资源在线 | 在线观看日韩精品 | 久久免费99精品久久久久久 | 欧美另类重口 | 日韩精品一卡 | 麻豆影视网站 | 中文字幕在线国产精品 | 91九色精品女同系列 | 97超碰在线播放 | 久久久18 | 精品v亚洲v欧美v高清v | 日韩a级黄色 | 99r在线视频 | 正在播放 久久 | 欧美国产日韩一区 | 精品99久久久久久 | 91麻豆国产福利在线观看 | 成年人免费av网站 | www.av小说 | 久久国产精品区 | 国产香蕉97碰碰碰视频在线观看 | 成人激情开心网 | 伊色综合久久之综合久久 | 色av男人的天堂免费在线 | 欧美国产视频在线 | 成年人免费在线看 | 97超碰精品| 操操操日日日干干干 | 国产免费一区二区三区最新 | 九九热99视频| 欧美色道 | 亚洲高清视频在线观看 | 久久国产精品二国产精品中国洋人 | a级一a一级在线观看 | av黄色在线播放 | 米奇影视7777| 日韩免费中文字幕 | 午夜av免费观看 | 久久精品美女视频网站 | 国产一级三级 | 久草在线手机观看 | 色综合久久综合 | 国产成人综合图片 | 日日夜色 | 免费看黄色91 | 国产不卡在线播放 | 日韩一区二区在线免费观看 | 国产亚洲成人网 | 久久天天躁 | 国产精品午夜av | 久久久精选| 国产最新精品视频 | 久久视频在线观看中文字幕 | 国产精品电影一区 | 日本韩国精品一区二区在线观看 | 成人av资源网站 | 久久精品中文字幕免费mv | 极品嫩模被强到高潮呻吟91 | 久久黄色片子 | 麻豆国产精品一区二区三区 | 在线观看中文 | 丁香亚洲 | 国产电影黄色av | 波多野结衣在线观看一区 | 在线性视频日韩欧美 | 精品夜夜嗨av一区二区三区 | 国产精品欧美久久久久三级 | 亚洲综合色av | 亚在线播放中文视频 | 国产va在线观看免费 | 不卡电影免费在线播放一区 | 精品国产免费看 | 国色天香永久免费 | 欧美极品久久 | 亚洲欧洲日韩 | 日韩试看 | 免费观看福利视频 | 日日精品| 亚洲在线国产 | 亚洲电影久久 | 人人射人人| 精品人人人人 | 亚洲免费观看在线视频 | 911国产 | 免费午夜在线视频 | 中文av一区二区 | 日本午夜免费福利视频 | 成人免费一级 | 免费在线观看a v | 综合网久久| 亚洲午夜激情网 | 色网免费观看 | 久久精品中文字幕免费mv | 国产精品大全 | 午夜精品久久久久久久久久久久久久 | 久色 网| 2022久久国产露脸精品国产 | 欧洲一区二区在线观看 | 国产成人精品一区二区在线 | 国产理论在线 | 国产中文字幕久久 | 久久精品视频18 | 欧美色久| 99精品在线观看 | 欧美一区免费观看 | 亚洲欧洲成人 | 亚洲免费av网站 | 香蕉免费| 午夜精品视频免费在线观看 | 久久久精品一区二区 | 久久免费在线观看视频 | 国内精品久久久久影院日本资源 | 国产一级性生活 | 亚洲精品字幕 | 久久久精品国产一区二区电影四季 | 午夜久久福利 | 欧美a级在线 | 免费av试看 | 色天天久久| 91av视频| 精品久久久免费视频 | 久久免费在线观看视频 | 国产精品爽爽久久久久久蜜臀 | 狠狠插狠狠干 | 久久精品九色 | 久久96国产精品久久99软件 | 成人资源站 | 日韩最新中文字幕 | 九九视频免费观看视频精品 | 久久久www成人免费精品张筱雨 | 欧美91成人网| 91视频下载 | 日日添夜夜添 | 亚洲国产精品女人久久久 | 欧美日韩不卡在线观看 | 丁香六月婷婷开心 | 波多野结衣在线观看视频 | 国产黄色片免费在线观看 | 一区二区视频播放 | 91在线免费公开视频 | 日韩在线观看免费 | 欧美日韩超碰 | 在线观看www91 | 99视频在线观看视频 | 国产一级二级在线观看 | 久久综合九色99 | 久久不卡av| 国产黄色在线观看 | 狠狠色噜噜狠狠狠狠2022 | 免费观看久久久 | 91精品国产乱码在线观看 | 不卡的av中文字幕 | 日韩av免费一区 | 韩国精品视频在线观看 | 久久av网 | 91亚洲精| 国产精品久久久久婷婷二区次 | 美女视频黄网站 | 成人黄色电影视频 | 国产 色| 国产精品免费久久久 | 日韩在线视频网址 | 91色国产| 久久久久久久久久影视 | 亚洲成人黄色网址 | 精品久久1 | 亚洲国产精品久久久久婷婷884 | 欧美一区二区三区在线 | 麻花传媒mv免费观看 | 天天色综合天天 | 精品一区二区亚洲 | 久久久蜜桃一区二区 | 国产成人61精品免费看片 | 色五月激情五月 | 久久精品中文视频 | 又黄又爽又湿又无遮挡的在线视频 | 日本护士三级少妇三级999 | 热久久视久久精品18亚洲精品 | 精品久久久成人 | 十八岁以下禁止观看的1000个网站 | 91成人在线观看喷潮 | 亚洲欧美日韩精品久久奇米一区 | 99热在线国产精品 | 久免费视频 | 99色婷婷 | 国产在线精品国自产拍影院 | 久久精品久久99精品久久 | 深爱激情五月婷婷 | 综合久久婷婷 | 色小说av | 国产97视频 | 国产成人精品一二三区 | 国产高清在线观看av | 久久99精品久久久久久秒播蜜臀 | 草久久av | 久久午夜免费视频 | 亚洲一区二区三区四区精品 | 国产成年免费视频 | 国产小视频在线看 | 免费在线观看av电影 | 亚洲免费av观看 | 久久精品视频网 | av中文字幕日韩 | 精品亚洲男同gayvideo网站 | av成人在线网站 | 狠狠色网| 亚洲国产大片 | 91九色视频国产 | 最新av免费在线 | 亚在线播放中文视频 | 韩日电影在线观看 | 日韩a欧美| 中文字幕av在线播放 | 久久免费公开视频 | 黄色精品网站 | 精品a在线 | 91人人爽人人爽人人精88v | 日本精a在线观看 | 婷婷久久五月 | 又黄又爽又无遮挡免费的网站 | 免费看的视频 | 337p日本欧洲亚洲大胆裸体艺术 | 天堂资源在线观看视频 | 人人爽人人澡人人添人人人人 | 婷婷av网| 中文字幕在线观看免费 | 午夜国产一区二区 | 91久久久久久国产精品 | 国内精品久久久久影院优 | h动漫中文字幕 | 国产美女视频一区 | 中文字幕在线观看网站 | 日韩啪啪小视频 | 久久久久久久久久久久99 | 99视频免费| 99精品国产在热久久 | 人人添人人 | 欧美激情视频一区二区三区 | 久久久久久久网 | 97手机电影网 | 亚洲免费永久精品国产 | 免费黄a| 特级西西人体444是什么意思 | 国产亚洲永久域名 | 精品一二三区视频 | 91成年人视频 | 亚洲成免费 | 免费看毛片在线 | 免费av黄色| 韩国av永久免费 | 国产午夜精品一区二区三区欧美 | 天天色播 | 欧洲视频一区 | 中文字幕色婷婷在线视频 | a级国产毛片| 国产1区2区3区在线 亚洲自拍偷拍色图 | 狠狠的操你 | 国产黄大片 | 国产精品精品国产婷婷这里av | 久久视频这里有精品 | 99热这里只有精品久久 | 久草精品在线 | 中文字幕在线观看免费观看 | 久久综合九九 | 日韩亚洲在线观看 | 操久久免费视频 | 国产精品一区二区三区免费视频 | 久久国产一区 | 一区二区 久久 | 91九色最新 | 黄色福利网站 | av免费线看| 中文欧美字幕免费 | 日韩一区视频在线 | 黄色视屏免费在线观看 | 中文字幕在线观看完整版 | 久久激情视频 | 成人黄大片视频在线观看 | 日日夜夜综合 | 国内久久| av成人免费在线观看 | 久久久久久久久影视 | 成年人在线免费视频观看 | 国产一级片久久 | 2022中文字幕在线观看 | 99视频免费在线观看 | 国产高清在线不卡 | 中文字幕欧美三区 | 97碰碰精品嫩模在线播放 | 中文字幕在线视频一区二区 | 亚洲 欧美 91| 91少妇精拍在线播放 | 色综合天天色综合 | 国产a视频免费观看 | 久久久久久精 | 精品视频免费 | 久草观看视频 | 国产一线天在线观看 | 久久嗨| 久久精品永久免费 | 久久麻豆精品 | av免费网| 欧美大片mv免费 | 在线观看91精品国产网站 | 久久精品一级片 | 国产不卡网站 | 97人人网 | 国产剧情一区二区在线观看 | 成年人在线电影 | 久久调教视频 | 午夜久久久久 | 麻豆91精品 | 精品久久久久亚洲 | 国产在线不卡 | av超碰在线观看 | 一区二区三区在线观看免费视频 | 综合网天天色 | 精品一二区 | 色天天| 最新日韩视频在线观看 | 精品久久久久国产免费第一页 | 中文字幕电影网 | 亚洲精品久久久久久久蜜桃 | 国产成人av电影在线观看 | 欧美成人xxxx| 国产高清免费视频 | 中文久草| 制服丝袜在线91 | 久久国产一二区 | 视频在线99re | 色网免费观看 | 国产精品字幕 | 最新国产一区二区三区 | 色综合久久久久久久久五月 | 日韩免费三级 | 三上悠亚一区二区在线观看 | 国产小视频在线免费观看视频 | 久久色在线观看 | 91精品国产高清自在线观看 | 亚洲成色 | 亚洲午夜久久久综合37日本 | 国产福利av| 欧美激情综合五月色丁香 | 激情婷婷网 | 久久久亚洲网站 | 亚洲专区欧美 | 99中文视频在线 | 亚洲黄色精品 | 国产不卡片 | 亚洲欧美在线视频免费 | 久久久久国产一区二区 | 精品1区2区3区 | 啪啪小视频网站 | 国产免费又爽又刺激在线观看 | 三级黄色免费片 | 久久久国产精品一区二区中文 | 亚洲欧美少妇 | 在线看一区二区 | 在线v| 黄色免费观看网址 | 天天激情站 | 日日操日日插 | 麻豆播放| 五月婷婷伊人网 | 国产精品二区在线观看 | 欧美国产精品一区二区 | 天天干天天草天天爽 | 国产精品一区欧美 | 亚洲精品99久久久久久 | av免费福利| 国产一级黄色片免费看 | 亚洲日本va午夜在线影院 | 激情婷婷在线观看 | 中文字幕久久亚洲 | 五月激情电影 | 欧美日本日韩aⅴ在线视频 插插插色综合 | 视频一区二区三区视频 | 国产一二区免费视频 | 在线免费视频a | 国产精品久久久久一区二区三区 | 五月天久久久久久 | 在线一区二区三区 | 人人干人人搞 | 五月视频 | 五月天国产精品 | 久久超碰99| 不卡的一区二区三区 | 狠狠干天天干 | 97精品视频在线播放 | 视频一区视频二区在线观看 | a视频在线 | 天天色欧美 | 国产亲近乱来精品 | 91av在线视频免费观看 | 日韩免费网站 | 91人人射| 日本中文字幕在线视频 | 天天操天天操天天爽 | 日韩激情影院 | av一级片在线观看 | 欧美在线一 | 视频在线国产 | www.夜夜草 | 久草在线视频在线观看 | 欧美一级黄色网 | 丁香五月缴情综合网 | 奇米网444| 久久免费在线视频 | 免费观看成年人视频 | 久久国产电影 | 国产成人一区二区三区 | av电影不卡在线 | 日本在线h | 欧美一区二区精品在线 | 亚洲精品国偷自产在线99热 | 国产在线不卡 | 国产精品久久久久久久免费观看 | 韩国中文三级 | 天天干天天干天天干天天干天天干天天干 | 欧美91av| 激情五月色播五月 | 六月丁香激情综合 | 91亚洲狠狠婷婷综合久久久 | 日韩在线视频在线观看 | 亚洲国产精品va在线 | 狠狠干夜夜操天天爽 | 日日躁夜夜躁xxxxaaaa | 日韩欧美精品一区 | 韩国av免费在线 | 国产91丝袜在线播放动漫 | 精品国产伦一区二区三区观看说明 | 97精品超碰一区二区三区 | 久久九九国产视频 | 国产精品一二 | 91av在线免费播放 | 成人午夜在线电影 | 狠狠色狠狠色综合系列 | 日韩精品在线视频 | 91人人揉日日捏人人看 | 五月天丁香综合 | 制服丝袜欧美 | 99视频精品免费观看, | 大型av综合网站 | 人人插人人搞 | 又长又大又黑又粗欧美 | 国内三级在线 | 国产亚洲精品美女久久 | 在线观看日本高清mv视频 | 99在线高清视频在线播放 | 亚洲热视频| 六月激情 | 天天草视频| 亚洲人人av | 91精品电影 | 亚洲综合色激情五月 | 成人精品久久久 | 五月婷婷丁香综合 | www.午夜色.com | 成人蜜桃网 | 亚洲人xxx | 亚洲精品久久久久久久不卡四虎 | 91最新地址永久入口 | 久av电影 | 色综合天 | 国产成人精品999在线观看 | 永久黄网站色视频免费观看w | 天天操天天干天天玩 | 欧美另类xxx | 在线观看的av | www.久久爱.cn | 久久免费视频1 | 亚州成人av在线 | 亚洲自拍偷拍色图 | 激情五月在线视频 | 亚洲免费在线视频 | 久久综合给合久久狠狠色 | 欧美在线观看小视频 | 天天综合网久久 | 中文免费 | 亚洲精品自在在线观看 | 国产美女精品人人做人人爽 | 人人爽人人爽人人片av | 蜜臀av性久久久久蜜臀av | 日韩一区二区免费播放 | 国产精品视频永久免费播放 | 国产剧情av在线播放 | 国产黄色播放 | 国产亚洲综合精品 | 黄色不卡av| 99色在线视频 | 日本中文字幕视频 | 天天操夜夜摸 | 在线观看中文字幕亚洲 | 五月开心六月婷婷 | 日韩欧美极品 | 天天艹 | 97电影手机版 | 亚洲免费视频在线观看 | 久久国产精品99久久久久久进口 | 久久久久久久亚洲精品 | 涩涩网站在线观看 | 国产一级二级在线 | 日韩精品在线免费观看 | 一区二区三区四区不卡 | 蜜臀av性久久久久蜜臀aⅴ流畅 | 午夜在线资源 | 丁香五香天综合情 | 国产一区二区在线免费 | 超碰在线1 | 一本到视频在线观看 | 亚洲电影图片小说 | www.一区二区三区 | 午夜精品剧场 | 欧美成人性网 | 特级毛片aaa | 久久久www成人免费精品张筱雨 | 亚洲小视频在线观看 | 精品久久久成人 | 久久国产精品一国产精品 | 国产精品成人久久久 | 午夜久操 | www操操 | av在线在线 | 在线香蕉视频 | 国产精品午夜在线 | 久久免费视频精品 | 久草在线最新 | 免费a网址 | 欧美激情亚洲综合 | 欧美日韩伦理一区 | 日韩素人在线观看 | 国内视频在线观看 | 丁香午夜 | 欧美一级性生活视频 | 99国产成+人+综合+亚洲 欧美 | 亚洲精品久久久久久中文传媒 | 国产日韩欧美中文 | 国产精品久久久久久久久久白浆 | 久久线视频 | 精品超碰| 久久成人国产精品一区二区 | 欧美天天综合网 | 精品国产自在精品国产精野外直播 | 久久99国产一区二区三区 | 丁香婷婷激情网 | 狠狠88综合久久久久综合网 | 国产在线不卡精品 | 亚洲国产成人在线观看 | 日韩专区中文字幕 | av亚洲产国偷v产偷v自拍小说 | 成人av在线网址 | 中文字幕在线中文 | 国产精品久久一区二区三区不卡 | 韩国av一区二区三区在线观看 | 最新一区二区三区 | 国产福利久久 | 91成人亚洲| 激情开心网站 | 在线观看视频你懂 | 青青网视频 | 天天狠狠| 国产精品成人品 | 日韩欧美视频在线播放 | av大全在线免费观看 | www.亚洲精品在线 | 蜜臀久久99静品久久久久久 | 日韩欧美国产精品 | 开心丁香婷婷深爱五月 | 蜜臀av性久久久久蜜臀aⅴ四虎 | 一二三精品视频 | 狠狠色噜噜狠狠狠狠2022 | 日本久久免费视频 | 丝袜+亚洲+另类+欧美+变态 | 免费在线观看av片 | 国产成人精品一区二区三区网站观看 | 91精品亚洲影视在线观看 | 亚洲永久av | 久久久久免费精品 | 欧洲精品视频一区二区 | 日韩极品视频在线观看 | 99久久综合精品五月天 | 国产视频一区二区三区在线 | 人人干人人搞 | 亚洲aⅴ在线观看 | www夜夜| a极黄色片| 久久久91精品国产一区二区精品 | 天天干天天拍天天操 | 一区二区三区中文字幕在线 | www.五月激情.com | av在线影视 | 久草视频一区 | 欧美在线视频a | 国产一区二区在线影院 | 久久99国产综合精品免费 | 青青河边草手机免费 | 久久99国产视频 | 日韩免费播放 | 色网站免费在线观看 | 在线观看蜜桃视频 | 国产亚洲成av片在线观看 | 免费男女羞羞的视频网站中文字幕 | 爱射综合 | 亚洲涩涩网 | 欧美日韩中文字幕在线视频 | 夜夜婷婷| 欧美日韩二三区 | 五月天激情视频 | 成人一区二区三区在线观看 | 91人人爱 | 久久亚洲综合国产精品99麻豆的功能介绍 | 色综合亚洲精品激情狠狠 | 久久美女免费视频 | 97碰在线| 国产视频丨精品|在线观看 国产精品久久久久久久久久久久午夜 | 日韩精品欧美专区 | av一二三区 | 婷婷在线网 | 国产麻豆精品久久 | 夜夜夜| 天天av资源 | 米奇影视7777 | 日韩在线视频一区 | 国产手机视频在线播放 | 综合国产在线观看 | 中文字幕av一区二区三区四区 | 97国产小视频 | 中文字幕在线播出 | 亚洲影院色 | 亚洲国产播放 | 国产午夜精品视频 | 天天天操天天天干 | 日韩综合视频在线观看 | 国产黄色免费 | www一起操| av色综合| 欧美精品一区在线发布 | 在线观看深夜福利 | 日韩婷婷 | 久久久这里有精品 | 国产黄色一级大片 | 国产亚洲婷婷 | 国产精品丝袜 | 国产精品婷婷午夜在线观看 | 亚州性色 | av在线免费在线 | 手机在线中文字幕 | 九九热中文字幕 | 精品一区二区在线观看 | 永久免费的啪啪网站免费观看浪潮 | 成人国产精品久久久久久亚洲 | 波多野结依在线观看 | 中文在线字幕观看电影 | 欧美一级专区免费大片 | 精品福利视频在线观看 | 五月花激情 | 精品国产人成亚洲区 | 69国产精品视频 | 亚洲不卡av一区二区三区 | 免费看片黄色 | 成人三级黄色 | 欧美日韩天堂 | 黄色精品一区 | 在线观看中文av |