Python入門篇-封裝與解構和高級數據類型集合(set)和字典(dict)


        Python入門篇-封裝與解構和高級數據類型集合(set)和字典(dict)

                                          作者:尹正傑

版權聲明:原創作品,謝絕轉載!否則將追究法律責任。

 

 

 

一.封裝和結構

 1 #!/usr/bin/env python
 2 #_*_conding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie
 5 
 6 
 7 
 8 x = 1,3,5,7                              #Python中的封裝,注意,這里把等號后邊的int數據類型封裝成元組了
 9 print(x)
10 
11 a,b = [100,200]                          #線性結構,可以同時為多個變量賦值
12 a,b = b,a                                #可以很輕松的實現數據交換
13 print(a,b)
14 
15 m,n = {"name":"Jason","Age":18}           #非線性結構也可以解構,即2邊的個數要相同,m和n這2個變量分別賦值
16 print(m,n)
17 
18 y,*z = 100,200,300,400,500,600           #注意,y為變量標識符,而z則為可變參數(可變參數只能存在一個,存在2個會報語法錯誤),他會把后面的元素放入到一個列表中
19 print(y,z)
20 
21 
22 head,*mid,tail = range(10)              #注意,這也是結構,左邊的標識符要大於或等於2個才能算得上結構喲~
23 print(head,mid,tail)
24 
25 x,[a,b],z = (1,[2,3],(4,5))             #當然,咱們也可以這樣去解構,它會按照我們的想法對號入座
26 print(x,a,b,z)
27 
28 
29 
30 #以上代碼執行結果如下:
31 (1, 3, 5, 7)
32 200 100
33 name Age
34 100 [200, 300, 400, 500, 600]
35 0 [1, 2, 3, 4, 5, 6, 7, 8] 9
36 1 2 3 (4, 5)

 

二.集合(set)

1>.集合的特點

約定
  set 翻譯為集合
  collection 翻譯為集合類型或容器,是一個大概念

set   可變的、無序的、不重復的元素的集合

2>.set定義和初始化

#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

'''
  set() -> new empty set object
  set(iterable) -> new set object
'''

s1 = set()

s2 = set(range(10))

s3 = set(list(range(20)))

#dict
s4 = {}

#set
s5 = {1,3,5,7,9}

s6 = {(1,3),5,'A'}

#集合只能存放不可變的的元素,如果存放list和bytearray時會報錯:"unhashable type"
s7 = {(2,),3,None,"abc",b"ABC"}

s8 = set(enumerate(range(5)))

print(s1)
print(s2)
print(s3)
print(s4)
print(s5)
print(s6)
print(s7)
print(s8)



#以上代碼執行結果如下:
set()
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}
{}
{1, 3, 5, 7, 9}
{'A', (1, 3), 5}
{3, None, (2,), b'ABC', 'abc'}
{(0, 0), (3, 3), (4, 4), (2, 2), (1, 1)}

3>.set的元素

set的元素要求必須可以hash

不可hash的類型有list、set,bytearray,dict

元素不可以索引

set可以迭代

4>.set增加

#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


'''
add(elem)
    增加一個元素到set中
    如果元素存在,什么都不做
'''

s1 = {1,3,5}
print(s1)

s1.add(100)
print(s1)



#以上代碼執行結果如下:
{1, 3, 5}
{1, 3, 100, 5}
add(elem)         #增加一個元素到set中,如果元素存在,什么都不做
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


'''
update(*others)
    合並其他元素到set集合中來
    參數others必須是可迭代對象
    就地修改
'''

s1 = {1,3,5}
print(s1,id(s1))

s1.update([1,3,2],[2,3,4],(6,8))
print(s1,id(s1))



#以上代碼執行結果如下:
{1, 3, 5} 31487144
{1, 2, 3, 4, 5, 6, 8} 31487144
update(*others)     #合並其他元素到set集合中來,參數others必須是可迭代對象,就地修改

5>.set刪除

#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


'''
remove(elem)
    從set中移除一個元素
    元素不存在,拋出KeyError異常。為什么是KeyError?因為這個key對應的是一個hash值。
'''

s1 = {1,3,5}
print(s1)

s1.remove(3)
print(s1)



#以上代碼執行結果如下:
{1, 3, 5}
{1, 5}
remove(elem)       #從set中移除一個元素,元素不存在,拋出KeyError異常
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


'''
pop() -> item
    移除並返回任意的元素。為什么是任意元素?
    空集返回KeyError異常
'''

s1 = {1,3,5}
print(s1)

s1.pop()
print(s1)



#以上代碼執行結果如下:
{1, 3, 5}
{3, 5}
pop() -> item      #移除並返回任意的元素。為什么是任意元素? 空集返回KeyError異常
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


'''
discard(elem)
     從set中移除一個元素
    元素不存在,什么都不做
'''

s1 = {1,3,5}
print(s1)

s1.discard(3)
print(s1)



#以上代碼執行結果如下:
{1, 3, 5}
{1, 5}
discard(elem)      #從set中移除一個元素,元素不存在,什么都不做,即不出錯版本的remove
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


'''
clear()
    移除所有元素
'''

s1 = {1,3,5}
print(s1)

s1.clear()
print(s1)



#以上代碼執行結果如下:
{1, 3, 5}
set()
clear()          #移除所有元素

6>.set修改、查詢

修改
  要么刪除,要么加入新的元素
  為什么沒有修改?

索引   非線性結構,無法索引,一般只有線性結構才會存在索引的概念。

查詢
  線性結構查詢時需要遍歷整個數據結構,時間復雜度為0(n);而非線性結構比如Set和Dict在查詢時會先求一個hash值,然后根據這個哈希值去相應的hash表中查找對應的數據,時間復雜度為O(1)。
遍歷   可以迭代所有元素,不管是線性結構還是非線性結構遍歷的速度都會很慢。因為時間復雜度都一樣,遍歷的時候只跟數據的規模有關。
成員運算符   
in 和not in 判斷元素是否在set中   效率要比線性結構數據要高,時間復雜度為O(1)。

7>.set成員運算符的比較

#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

import datetime

#注意,這個值我們可以調大里面的數字進行測試,如果在后面再加一個0就會把內存吃滿。
list_1 = list(range(100000000))
start = datetime.datetime.now()
a = -1 in list_1
end = datetime.datetime.now()

print("在列表中遍歷一個數字耗時為:{}".format(end - start))

set1 = set(range(100000000))
start = datetime.datetime.now()
a = -1 in set1
end = datetime.datetime.now()
print("在集合中遍歷一個數字耗時為:{}".format(end - start))



#以上代碼執行結果如下:
在列表中遍歷一個數字耗時為:0:00:01.236070
在集合中遍歷一個數字耗時為:0:00:00

8>.set和線性結構

  線性結構的查詢時間復雜度是O(n),即隨着數據規模的增大而增加耗時
  set、dict等結構,內部使用hash值作為key,時間復雜度可以做到O(1),查詢時間和數據規模無關
  
  可hash     數值型int、float、complex     布爾型True、False     字符串string、bytes     tuple     None     以上都是不可變類型,稱為可哈希類型,hashable。當然還有其它自定義類型也可實現hash,我們暫時先不考慮。
  set的元素必須是可hash的

9>.集合運算

基本概念
  全集
    所有元素的集合。例如實數集,所有實數組成的集合就是全集
  子集subset和超集superset
    一個集合A所有元素都在另一個集合B內,A是B的子集,B是A的超集
  真子集和真超集
    A是B的子集,且A不等於B,A就是B的真子集,B是A的真超集
  並集:多個集合合並的結果
  交集:多個集合的公共部分
  差集:集合中除去和其他集合公共部分
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

'''
並集
    將兩個集合A和B的所有的元素合並到一起,組成的集合稱作集合A與集合B的並集
    union(*others)
        返回和多個集合合並后的新的集合
    | 運算符重載
        等同union
    update(*others)
        和多個集合合並,就地修改
    |=
        等同update
'''

s1 = {1,3,5}
s2 = {2,4,6}
print("s1 = {}".format(s1))
print("s2 = {}".format(s2))

s3 =s1.union(s2)
print("s3 = {}".format(s3))

s4 = s1 | s2
print("s4 = {}".format(s4))

s1.update(s2)
print("s1 = {}".format(s1))
print("s2 = {}".format(s2))

s2 |= s1
print("s1 = {}".format(s1))
print("s2 = {}".format(s2))




#以上代碼執行結果如下:
s1 = {1, 3, 5}
s2 = {2, 4, 6}
s3 = {1, 2, 3, 4, 5, 6}
s4 = {1, 2, 3, 4, 5, 6}
s1 = {1, 2, 3, 4, 5, 6}
s2 = {2, 4, 6}
s1 = {1, 2, 3, 4, 5, 6}
s2 = {1, 2, 3, 4, 5, 6}
並集:將兩個集合A和B的所有的元素合並到一起,組成的集合稱作集合A與集合B的並集
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

'''
交集
    集合A和B,由所有屬於A且屬於B的元素組成的集合
    intersection(*others)
        返回和多個集合的交集
    &
        等同intersection
    intersection_update(*others)
        獲取和多個集合的交集,並就地修改
    &=
        等同intersection_update
'''

s1 = {1,3,5}
s2 = {1,2,3,4,5,6}
print("s1 = {}".format(s1))
print("s2 = {}".format(s2))

s3 = s1.intersection(s2)
print("s3 = {}".format(s3))

s4 = s1 & s2
print("s4 = {}".format(s4))

s1.intersection_update(s2)
print("s1 = {}".format(s1))
print("s2 = {}".format(s2))

s2 &= s1
print("s1 = {}".format(s1))
print("s2 = {}".format(s2))



#以上代碼執行結果如下:
s1 = {1, 3, 5}
s2 = {1, 2, 3, 4, 5, 6}
s3 = {1, 3, 5}
s4 = {1, 3, 5}
s1 = {1, 3, 5}
s2 = {1, 2, 3, 4, 5, 6}
s1 = {1, 3, 5}
s2 = {1, 3, 5}
交集:集合A和B,由所有屬於A且屬於B的元素組成的集合
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

'''
差集
    集合A和B,由所有屬於A且不屬於B的元素組成的集合
    difference(*others)
        返回和多個集合的差集
    -
        等同difference
    difference_update(*others)
        獲取和多個集合的差集並就地修改
    -=
        等同difference_update
'''

s1 = {1,3,5}
s2 = {1,2,3,4,5,6,7,8,9}
print("s1 = {}".format(s1))
print("s2 = {}".format(s2))

s3 = s2.difference(s1)
print("s3 = {}".format(s3))

s2.difference_update(s1)
print("s1 = {}".format(s1))
print("s2 = {}".format(s2))

s4 = {1,3,5,100,200,300}
s1 -= s4
print("s1 = {}".format(s1))
print("s2 = {}".format(s2))
print("s4 = {}".format(s4))



#以上代碼執行結果如下:
s1 = {1, 3, 5}
s2 = {1, 2, 3, 4, 5, 6, 7, 8, 9}
s3 = {2, 4, 6, 7, 8, 9}
s1 = {1, 3, 5}
s2 = {2, 4, 6, 7, 8, 9}
s1 = set()
s2 = {2, 4, 6, 7, 8, 9}
s4 = {1, 3, 100, 5, 200, 300}
差集:集合A和B,由所有屬於A且不屬於B的元素組成的集合
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

'''
對稱差集
    集合A和B,由所有不屬於A和B的交集元素組成的集合,記作(A-B)∪(B-A)
    symmetric_differece(other)
    返回和另一個集合的差集
    ^
        等同symmetric_differece
    symmetric_differece_update(other)
        獲取和另一個集合的差集並就地修改
    ^=
        等同symmetric_differece_update
'''

s1 = {1,3,5}
s2 = {100,200,300}
print("s1 = {}".format(s1))
print("s2 = {}".format(s2))

s3 = s1.symmetric_difference(s2)
print("s3 = {}".format(s3))

s4 = s1 ^ s2
print("s4 = {}".format(s4))


s1.symmetric_difference_update(s2)
print("s1 = {}".format(s1))
print("s2 = {}".format(s2))

s2 ^= s1
print("s1 = {}".format(s1))
print("s2 = {}".format(s2))



#以上代碼執行結果如下:
s1 = {1, 3, 5}
s2 = {200, 100, 300}
s3 = {1, 3, 100, 5, 200, 300}
s4 = {1, 3, 100, 5, 200, 300}
s1 = {1, 3, 100, 5, 200, 300}
s2 = {200, 100, 300}
s1 = {1, 3, 100, 5, 200, 300}
s2 = {1, 3, 5}
對稱差集:集合A和B,由所有不屬於A和B的交集元素組成的集合,記作(A-B)∪(B-A)

10>.集合運算

#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

'''
issubset(other)、<=
    判斷當前集合是否是另一個集合的子集
'''

s1 = {1,3,5}
s2 = {1,3,5,7,9}
print("s1 = {}".format(s1))
print("s2 = {}".format(s2))

#判斷當前集合是否是另一個集合的子集
print(s1.issubset(s2))

#判斷s2是否是s1的真子集
print(s2 < s1)

#判斷當前集合是否是other的超集
print(s2.issuperset(s1))
print(s2 >= s1)

#判斷s2是否是s1的真超集
print(s2 > s1)

#當前集合和另一個集合沒有交集,沒有交集,則返回True
print(s2.isdisjoint(s1))



#以上代碼執行結果如下:
s1 = {1, 3, 5}
s2 = {1, 3, 5, 7, 9}
True
False
True
True
True
False

11>.集合應用

共同好友
  你的好友A、B、C,他的好友C、B、D,求共同好友
  交集問題:{'A', 'B', 'C'}.intersection({'B', 'C', 'D'})

微信群提醒
  XXX與群里其他人都不是微信朋友關系
  並集:userid in (A | B | C | ...) == False,A、B、C等是微信好友的並集,用戶ID不在這個並集中,說明他和任何人都不是朋友(這種方法時可以實現的但是可能會存在占用過多的內存空間)
  群里所有其他人IDs都不在X的朋友列表T中。  T & IDs == set() 權限判斷   有一個API,要求權限同時具備A、B、C才能訪問,用戶權限是B、C、D,判斷用戶是否能夠訪問該API       API集合A,權限集合P       A
- P = {} ,A-P為空集,說明P包含A       A.issubset(P) 也行,A是P的子集也行       A & P = A 也行   有一個API,要求權限具備A、B、C任意一項就可訪問,用戶權限是B、C、D,判斷用戶是否能夠訪問該API       API集合A,權限集合P       A & P != {} 就可以       A.isdisjoint(P) == False 表示有交集 一個總任務列表,存儲所有任務。一個完成的任務列表。找出為未完成的任務   業務中,任務ID一般不可以重復   所有任務ID放到一個set中,假設為ALL   所有已完成的任務ID放到一個set中,假設為COMPLETED,它是ALL的子集   ALL - COMPLETED = UNCOMPLETED

12>.集合練習

隨機產生2組各10個數字的列表,如下要求:
  每個數字取值范圍[10,20]
  統計20個數字中,一共有多少個不同的數字?
  2組中,不重復的數字有幾個?分別是什么?
  2組中,重復的數字有幾個?分別是什么?
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com



a = [1, 9, 7, 5, 6, 7, 8, 8, 2, 6]
b = [1, 9, 0, 5, 6, 4, 8, 3, 2, 3]
s1 = set(a)
s2 = set(b)
print(s1)
print(s2)
print(s1.union(s2))
print(s1.symmetric_difference(s2))
print(s1.intersection(s2))



#以上代碼執行結果如下:
{1, 2, 5, 6, 7, 8, 9}
{0, 1, 2, 3, 4, 5, 6, 8, 9}
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
{0, 3, 4, 7}
{1, 2, 5, 6, 8, 9}
參考案例 

 

三.字典(dict)

1>.字典特點

key-value鍵值對的數據的集合

可變的、無序的、key不重復

2>.字典定義和初始化

#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

#定義一個空字典
d1 = dict()

#和上面的方法一致,也是定義了一個空字典
d2 = {}

#dict(**kwargs) 使用name=value對初始化一個字典
d3 = dict(a=10,b=20,c=[123])

#dict(iterable, **kwarg) 使用可迭代對象和name=value對構造字典,不過可迭代對象的元素必須是一個二元結構
d4 = dict(((1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e')))
d5 = dict(([1,'a'],[2,'b'],[3,'c'],[4,'d'],(5,'e')))

#dict(mapping, **kwarg) 使用一個字典構建另一個字典
d6 = {'a':10, 'b':20, 'c':None, 'd':[1,2,3]}

#類方法dict.fromkeys(iterable, value)
d7 = dict.fromkeys(range(5))
d8 = dict.fromkeys(range(5),666)


print("d1 = {}".format(d1))
print("d2 = {}".format(d2))
print("d3 = {}".format(d3))
print("d4 = {}".format(d4))
print("d5 = {}".format(d5))
print("d6 = {}".format(d6))
print("d7 = {}".format(d7))
print("d8 = {}".format(d8))



#以上代碼輸出結果如下:
d1 = {}
d2 = {}
d3 = {'a': 10, 'b': 20, 'c': [123]}
d4 = {1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e'}
d5 = {1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e'}
d6 = {'a': 10, 'b': 20, 'c': None, 'd': [1, 2, 3]}
d7 = {0: None, 1: None, 2: None, 3: None, 4: None}
d8 = {0: 666, 1: 666, 2: 666, 3: 666, 4: 666}

3>.字典元素的訪問

#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


'''
d[key]
    返回key對應的值value
    key不存在拋出KeyError異常
'''

d1 = {'Name': "Jason Yin", 'Age': 18, 'Hobby': ["跑步","旅行","寫博客"]}

print("d1 = {}".format(d1))
print("姓名:{},年齡:{},愛好:{}".format(d1["Name"],d1["Age"],d1["Hobby"]))



#以上代碼輸出結果如下:
d1 = {'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}
姓名:Jason Yin,年齡:18,愛好:['跑步', '旅行', '寫博客']
d[key]               #返回key對應的值value key不存在拋出KeyError異常
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


'''
get(key[, default])
    返回key對應的值value
    key不存在返回缺省值,如果沒有設置缺省值就返回None
'''

d1 = {'Name': "Jason Yin", 'Age': 18, 'Hobby': ["跑步","旅行","寫博客"]}


print(d1.get("Name"))

print(d1.get("forte"))
print(d1.get("forte","該key不存在!"))


#以上代碼執行結果如下:
Jason Yin
None
該key不存在!
get(key[, default])       #返回key對應的值value key不存在返回缺省值,如果沒有設置缺省值就返回None
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


'''
setdefault(key[, default])
    返回key對應的值value
    key不存在,添加kv對,value為default,並返回default,如果default沒有設置,缺省為None
'''

d1 = {'Name': "Jason Yin", 'Age': 18, 'Hobby': ["跑步","旅行","寫博客"]}

print("d1={}".format(d1))

print(d1.setdefault("Name","Yinzhengjie"))

print(d1.setdefault("forte","大數據運維開發"))

print("d1={}".format(d1))



#以上代碼執行結果如下:
d1={'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}
Jason Yin
大數據運維開發
d1={'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客'], 'forte': '大數據運維開發'}
setdefault(key[, default])   #返回key對應的值value key不存在,添加kv對,value為default,並返回default,如果default沒有設置,缺省為None

4>.字典增加和修改

#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

'''
d[key] = value
    將key對應的值修改為value
    key不存在添加新的kv對
'''

d1 = {'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}
print("d1={}".format(d1))

d1["Name"] = "Yinszhengjie"
print("d1={}".format(d1))

d1["forte"] = "大數據運維開發"
print("d1={}".format(d1))


#以上代碼執行結果如下:
d1={'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}
d1={'Name': 'Yinszhengjie', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}
d1={'Name': 'Yinszhengjie', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客'], 'forte': '大數據運維開發'}
d[key] = value          #將key對應的值修改為value key不存在添加新的kv對
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

'''
update([other]) -> None
    使用另一個字典的kv對更新本字典
    key不存在,就添加
    key存在,覆蓋已經存在的key對應的值
    就地修改
'''

d1 = {'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}
print("d1={}".format(d1))

d1.update(Age=20)
print("d1={}".format(d1))

d1.update((('Age',24),))
print("d1={}".format(d1))

d1.update({"Age":26})
print("d1={}".format(d1))


#以上代碼執行結果如下:
d1={'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}
d1={'Name': 'Jason Yin', 'Age': 20, 'Hobby': ['跑步', '旅行', '寫博客']}
d1={'Name': 'Jason Yin', 'Age': 24, 'Hobby': ['跑步', '旅行', '寫博客']}
d1={'Name': 'Jason Yin', 'Age': 26, 'Hobby': ['跑步', '旅行', '寫博客']}
update([other]) -> None     #使用另一個字典的kv對更新本字典 key不存在,就添加 key存在,覆蓋已經存在的key對應的值 就地修改

5>.字典刪除

#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

'''
pop(key[, default])
    key存在,移除它,並返回它的value
    key不存在,返回給定的default
    default未設置,key不存在則拋出KeyError異常
'''

d1 = {'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}
print("d1={}".format(d1))

d1.pop("Hobby")
print("d1={}".format(d1))



#以上代碼執行結果如下:
d1={'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}
d1={'Name': 'Jason Yin', 'Age': 18}
pop(key[, default])       #key存在,移除它,並返回它的value key不存在,返回給定的default default未設置,key不存在則拋出KeyError異常
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

'''
popitem()
    移除並返回一個任意的鍵值對
    字典為empty,拋出KeyError異常
'''

d1 = {'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}
print("d1={}".format(d1))

d1.popitem()
print("d1={}".format(d1))



#以上代碼執行結果如下:
d1={'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}
d1={'Name': 'Jason Yin', 'Age': 18}
popitem()             #移除並返回一個任意的鍵值對 字典為empty,拋出KeyError異常
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

'''
clear()
    清空字典
'''

d1 = {'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}
print("d1={}".format(d1))

d1.clear()
print("d1={}".format(d1))


#以上代碼執行結果如下:
d1={'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}
d1={}
clear()              #清空字典
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

'''
    del語句
'''

a = True
b = [6]
d = {'a': 1, 'b': b, 'c': [1,3,5]}
print("a = {}".format(a))
print("b = {}".format(b))
print("d = {}".format(d))

#刪除對象“a”
del a

#看着像刪除了一個對象,本質上減少了一個對象的引用,del 實際上刪除的是名稱,而不是對象
del d['c']
del b[0]

c = b
del c
del b
b = d['b']

# print("a = {}".format(a))
print("b = {}".format(b))
print("d = {}".format(d))
# print("c = {}".format(c))


#以上代碼執行結果如下:
a = True
b = [6]
d = {'a': 1, 'b': [6], 'c': [1, 3, 5]}
b = []
d = {'a': 1, 'b': []}
del語句

6>.字典遍歷

總結:
  Python3中,keys、values、items方法返回一個類似一個生成器的可迭代對象,不會把函數的返回結果復制到內存中
    它返回是一個Dictionary view對象,可以使用len(),iter(),in方法。需要注意的是,我們在遍歷字典的時候不推薦對key的元素進行增刪,因為你改動后會改變size的大小,如果強行執行key的刪除會拋出異常的。
    字典的entry的動態的視圖,字典變化,視圖將反映出這些變化
    keys返回一個類set對象,也就是可以看做一個set集合。如果values都可以hash,那么items也可以看作是類set對象   Python2中,上面的方法會返回一個新的列表,占據新的內存空間。所以Python2建議使用iterkeys、itervalues、iteritems版本,返回一個迭代器,而不是一個copy。
字典的key要求和set的元素要求一致:   set的元素可以就是看做key,set可以看做dict的簡化版   hashable 可哈希才可以作為key,可以使用hash()測試   d
= {1 : 0, 2.0 : 3, "abc" : None, ('hello', 'world', 'python') : "string", b'abc' : '135'}
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


d1 = {'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}


for item in d1:
    print(item)

print("*" * 20 + "我是分割線" + "*" * 20)
for item in d1.keys():
    print(item)

#以上代碼執行結果如下:
Name
Age
Hobby
********************我是分割線********************
Name
Age
Hobby
只遍歷keys
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


d1 = {'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}


for item in d1:
    print(d1[item])

print("*" * 20 + "我是分割線" + "*" * 20)

for item in d1.keys():
    print(d1.get(item))

print("*" * 20 + "我是分割線" + "*" * 20)

for item in d1.values():
    print(item)



#以上代碼執行結果如下:
Jason Yin
18
['跑步', '旅行', '寫博客']
********************我是分割線********************
Jason Yin
18
['跑步', '旅行', '寫博客']
********************我是分割線********************
Jason Yin
18
['跑步', '旅行', '寫博客']
只遍歷values
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


d1 = {'Name': 'Jason Yin', 'Age': 18, 'Hobby': ['跑步', '旅行', '寫博客']}


for item in d1.items():
    print(item)

print("*" * 20 + "我是分割線" + "*" * 20)

for item in d1.items():
    print(item[0],item[1])

print("*" * 20 + "我是分割線" + "*" * 20)

for k,v in d1.items():
    print(k,v)

print("*" * 20 + "我是分割線" + "*" * 20)

for k,_ in d1.items():
    print(k)

print("*" * 20 + "我是分割線" + "*" * 20)

for _,v in d1.items():
    print(v)


#以上代碼執行結果如下:
('Name', 'Jason Yin')
('Age', 18)
('Hobby', ['跑步', '旅行', '寫博客'])
********************我是分割線********************
Name Jason Yin
Age 18
Hobby ['跑步', '旅行', '寫博客']
********************我是分割線********************
Name Jason Yin
Age 18
Hobby ['跑步', '旅行', '寫博客']
********************我是分割線********************
Name
Age
Hobby
********************我是分割線********************
Jason Yin
18
['跑步', '旅行', '寫博客']
遍歷key和vlaue鍵值對

7>.defaultdict

#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

"""
collections.defaultdict([default_factory[, ...]])
    第一個參數是default_factory,缺省是None,它提供一個初始化函數。當key不存在的時候,會調用這個工廠函數來生成key對應的value
"""


from collections import defaultdict
import random

d1 = {}

d2 = defaultdict(list)

print("d1={}".format(d1))
print("d2={}".format(d2))

for k in "abcde":
    for v in range(random.randint(1,5)):
        if k not in d1.keys():
            d1[k] = []
        d1[k].append(v)

print("d1={}".format(d1))

for k in "mnopq":
    for v in range(random.randint(1,5)):
        d2[k].append(v)
print("d2={}".format(d2))


#以上代碼輸出結果如下所示:
d1={}
d2=defaultdict(<class 'list'>, {})
d1={'a': [0, 1, 2], 'b': [0, 1, 2], 'c': [0, 1, 2, 3, 4], 'd': [0, 1, 2], 'e': [0]}
d2=defaultdict(<class 'list'>, {'m': [0, 1, 2, 3], 'n': [0, 1, 2], 'o': [0, 1, 2], 'p': [0, 1, 2, 3, 4], 'q': [0, 1]})

8>.orderedDict

#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

"""
collections.OrderedDict([items])
    key並不是按照加入的順序排列,可以使用OrderedDict記錄順序


有序字典可以記錄元素插入的順序,打印的時候也是按照這個順序輸出打印
3.6版本的Python的字典就是記錄key插入的順序(IPython不一定有效果)


應用場景:
    假如使用字典記錄了N個產品,這些產品使用ID由小到大加入到字典中
    除了使用字典檢索的遍歷,有時候需要取出ID,但是希望是按照輸入的順序,因為輸入順序是有序的
    否則還需要重新把遍歷到的值排序
"""


from collections import OrderedDict
import random

d = {'banana': 3, 'apple': 4, 'pear': 1, 'orange': 2,'leechee':5}
print("d = {}".format(d))

keys = list(d.keys())
random.shuffle(keys)
print("keys = {}".format(keys))

od = OrderedDict()
for key in keys:
    od[key] = d[key]

print("od = {}".format(od))
print("od.keys() = {}".format(od.keys()))



#以上代碼執行結果如下:
d = {'banana': 3, 'apple': 4, 'pear': 1, 'orange': 2, 'leechee': 5}
keys = ['leechee', 'apple', 'pear', 'orange', 'banana']
od = OrderedDict([('leechee', 5), ('apple', 4), ('pear', 1), ('orange', 2), ('banana', 3)])
od.keys() = odict_keys(['leechee', 'apple', 'pear', 'orange', 'banana'])

9>.字典小試牛刀

需求一:用戶輸入一個數字
    打印每一位數字及其重復的次數

需求二:數字重復統計     隨機產生100個整數     數字的范圍[
-1000, 1000]     升序輸出所有不同的數字及其重復的次數
需求三:字符串重復統計     字符表
'abcdefghijklmnopqrstuvwxyz'     隨機挑選2個字母組成字符串,共挑選100個     降序輸出所有不同的字符串及重復的次數
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


'''
用戶輸入一個數字
    打印每一位數字及其重復的次數
'''


num = input("請輸入一個整數:>>> ")

d = {}

for key in num:
    if not d.get(key):
        d[key] = 1
        continue
    d[key] += 1

print(d)



#以上代碼執行結果如下:
請輸入一個整數:>>> 10086
{'1': 1, '0': 2, '8': 1, '6': 1}
需求一(解法一)
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


'''
用戶輸入一個數字
    打印每一位數字及其重復的次數
'''


num = input("請輸入一個整數:>>> ")

d = {}

for key in num:
    if not d.get(key):
        d[key] = 1
    else:
        d[key] += 1
        
print(d)



#以上代碼執行結果如下:
請輸入一個整數:>>> 10086
{'1': 1, '0': 2, '8': 1, '6': 1}
需求一(解法二)
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

import random
"""
數字重復統計
    隨機產生100個整數
    數字的范圍[-1000, 1000]
    升序輸出所有不同的數字及其重復的次數
"""

n = 100

nums =  [0] * n

d = {}

for i in range(n):
    nums[i] = random.randint(-1000,1000)

print(nums)

t = nums.copy()
t.sort()
print(t)

d = {}
for x in nums:
    if x not  in d.keys():
        d[x] = 1
    else:
        d[x] += 1

print(d)

d1 = sorted(d.items())
print(d1)




#以上代碼執行結果如下:
[192, -254, 796, 920, -764, 28, -972, 48, -709, 613, 927, 191, -480, -461, 199, -686, -846, 448, -49, -588, 129, -295, 229, 433, 938, -363, -573, 181, 565, 906, 667, -615, 422, -614, -492, -373, 678, 123, 193, 308, -84, -493, 503, 203, -837, -386, -210, 897, 683, -206, -987, -660, -801, 402, 311, -562, -655, 936, 997, 892, -134, -664, -805, -573, 124, 399, 992, 999, -802, -17, -588, 11, 599, -221, -746, 199, 680, -276, 88, -945, -573, -29, -939, 181, 495, -763, -384, 916, 150, -681, 509, -795, -100, 391, -614, -115, 210, -836, -401, 413]
[-987, -972, -945, -939, -846, -837, -836, -805, -802, -801, -795, -764, -763, -746, -709, -686, -681, -664, -660, -655, -615, -614, -614, -588, -588, -573, -573, -573, -562, -493, -492, -480, -461, -401, -386, -384, -373, -363, -295, -276, -254, -221, -210, -206, -134, -115, -100, -84, -49, -29, -17, 11, 28, 48, 88, 123, 124, 129, 150, 181, 181, 191, 192, 193, 199, 199, 203, 210, 229, 308, 311, 391, 399, 402, 413, 422, 433, 448, 495, 503, 509, 565, 599, 613, 667, 678, 680, 683, 796, 892, 897, 906, 916, 920, 927, 936, 938, 992, 997, 999]
{192: 1, -254: 1, 796: 1, 920: 1, -764: 1, 28: 1, -972: 1, 48: 1, -709: 1, 613: 1, 927: 1, 191: 1, -480: 1, -461: 1, 199: 2, -686: 1, -846: 1, 448: 1, -49: 1, -588: 2, 129: 1, -295: 1, 229: 1, 433: 1, 938: 1, -363: 1, -573: 3, 181: 2, 565: 1, 906: 1, 667: 1, -615: 1, 422: 1, -614: 2, -492: 1, -373: 1, 678: 1, 123: 1, 193: 1, 308: 1, -84: 1, -493: 1, 503: 1, 203: 1, -837: 1, -386: 1, -210: 1, 897: 1, 683: 1, -206: 1, -987: 1, -660: 1, -801: 1, 402: 1, 311: 1, -562: 1, -655: 1, 936: 1, 997: 1, 892: 1, -134: 1, -664: 1, -805: 1, 124: 1, 399: 1, 992: 1, 999: 1, -802: 1, -17: 1, 11: 1, 599: 1, -221: 1, -746: 1, 680: 1, -276: 1, 88: 1, -945: 1, -29: 1, -939: 1, 495: 1, -763: 1, -384: 1, 916: 1, 150: 1, -681: 1, 509: 1, -795: 1, -100: 1, 391: 1, -115: 1, 210: 1, -836: 1, -401: 1, 413: 1}
[(-987, 1), (-972, 1), (-945, 1), (-939, 1), (-846, 1), (-837, 1), (-836, 1), (-805, 1), (-802, 1), (-801, 1), (-795, 1), (-764, 1), (-763, 1), (-746, 1), (-709, 1), (-686, 1), (-681, 1), (-664, 1), (-660, 1), (-655, 1), (-615, 1), (-614, 2), (-588, 2), (-573, 3), (-562, 1), (-493, 1), (-492, 1), (-480, 1), (-461, 1), (-401, 1), (-386, 1), (-384, 1), (-373, 1), (-363, 1), (-295, 1), (-276, 1), (-254, 1), (-221, 1), (-210, 1), (-206, 1), (-134, 1), (-115, 1), (-100, 1), (-84, 1), (-49, 1), (-29, 1), (-17, 1), (11, 1), (28, 1), (48, 1), (88, 1), (123, 1), (124, 1), (129, 1), (150, 1), (181, 2), (191, 1), (192, 1), (193, 1), (199, 2), (203, 1), (210, 1), (229, 1), (308, 1), (311, 1), (391, 1), (399, 1), (402, 1), (413, 1), (422, 1), (433, 1), (448, 1), (495, 1), (503, 1), (509, 1), (565, 1), (599, 1), (613, 1), (667, 1), (678, 1), (680, 1), (683, 1), (796, 1), (892, 1), (897, 1), (906, 1), (916, 1), (920, 1), (927, 1), (936, 1), (938, 1), (992, 1), (997, 1), (999, 1)]
需求二
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com


import  random

"""
字符串重復統計
    字符表'abcdefghijklmnopqrstuvwxyz'
    隨機挑選2個字母組成字符串,共挑選100個
    降序輸出所有不同的字符串及重復的次數
"""


alphabet = "abcdefghijklmnopqrstuvwxyz"

words = []

for _ in range(100):
    words.append("".join(random.choice(alphabet) for _ in range(2)))        #生成器

d = {}

for x in  words:
    d[x] = d.get(x,0) + 1

print(d)

d1 = sorted(d.items(),reverse=True)
print(d1)



#以上代碼執行結果如下:
{'jc': 2, 'sf': 1, 'ju': 1, 'ek': 2, 'il': 1, 'ii': 1, 'db': 1, 'wi': 1, 've': 1, 'ys': 1, 'hm': 1, 'qs': 1, 'hk': 1, 'ok': 1, 'kb': 1, 'uc': 1, 'zj': 1, 'go': 1, 'ot': 1, 'wm': 1, 'ca': 1, 'lz': 1, 'wc': 1, 'av': 1, 'li': 2, 'tn': 1, 'qh': 1, 'fw': 1, 'vr': 1, 'vg': 1, 'rb': 1, 'jf': 1, 'cy': 1, 'iv': 1, 'oi': 1, 'ms': 1, 'de': 1, 'hr': 1, 'ua': 1, 'lq': 1, 'yt': 1, 'nq': 1, 'hu': 1, 'uf': 2, 'cc': 1, 'qx': 1, 'kr': 2, 'ez': 1, 'em': 1, 'zh': 1, 'tb': 1, 'cg': 1, 'tz': 1, 'xf': 1, 'hb': 1, 'va': 1, 'lb': 3, 'nd': 1, 'we': 1, 'tw': 1, 'pj': 1, 'rf': 1, 'gg': 1, 'oc': 1, 'vs': 1, 'vk': 1, 'ap': 1, 'fx': 1, 'ut': 1, 'lr': 1, 'wb': 1, 'og': 1, 'pa': 1, 'cr': 1, 'ul': 1, 'oa': 1, 'yq': 2, 'sz': 1, 'fu': 1, 'wh': 1, 'si': 1, 'jb': 1, 'nx': 1, 'po': 1, 'fq': 1, 'lu': 1, 'uv': 1, 'vq': 1, 'py': 1, 'wg': 2, 'pc': 1}
[('zj', 1), ('zh', 1), ('yt', 1), ('ys', 1), ('yq', 2), ('xf', 1), ('wm', 1), ('wi', 1), ('wh', 1), ('wg', 2), ('we', 1), ('wc', 1), ('wb', 1), ('vs', 1), ('vr', 1), ('vq', 1), ('vk', 1), ('vg', 1), ('ve', 1), ('va', 1), ('uv', 1), ('ut', 1), ('ul', 1), ('uf', 2), ('uc', 1), ('ua', 1), ('tz', 1), ('tw', 1), ('tn', 1), ('tb', 1), ('sz', 1), ('si', 1), ('sf', 1), ('rf', 1), ('rb', 1), ('qx', 1), ('qs', 1), ('qh', 1), ('py', 1), ('po', 1), ('pj', 1), ('pc', 1), ('pa', 1), ('ot', 1), ('ok', 1), ('oi', 1), ('og', 1), ('oc', 1), ('oa', 1), ('nx', 1), ('nq', 1), ('nd', 1), ('ms', 1), ('lz', 1), ('lu', 1), ('lr', 1), ('lq', 1), ('li', 2), ('lb', 3), ('kr', 2), ('kb', 1), ('ju', 1), ('jf', 1), ('jc', 2), ('jb', 1), ('iv', 1), ('il', 1), ('ii', 1), ('hu', 1), ('hr', 1), ('hm', 1), ('hk', 1), ('hb', 1), ('go', 1), ('gg', 1), ('fx', 1), ('fw', 1), ('fu', 1), ('fq', 1), ('ez', 1), ('em', 1), ('ek', 2), ('de', 1), ('db', 1), ('cy', 1), ('cr', 1), ('cg', 1), ('cc', 1), ('ca', 1), ('av', 1), ('ap', 1)]
需求三

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM