日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

神经网络与深度学习——TensorFlow2.0实战(笔记)(四)(python字典和集合)

發布時間:2023/12/10 python 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 神经网络与深度学习——TensorFlow2.0实战(笔记)(四)(python字典和集合) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

字典和集合

字典

每個字典元素都是一個鍵(關鍵字)/值(關鍵字對應的取值)對

#創建字典 dic_score={"語文":80,"數學":99} #打印 print(dic_score) print(dic_score["語文"]) #長度 print(dic_score.__len__)#錯誤寫法 print(len(dic_score)) #存在判斷是否存在 in print("語文" in dic_score) """ keys()返回字典中所有關鍵字 values()返回字典中所有值 items()返回字典中所有鍵值對 """ #遍歷 for key in dic_score.keys():print(key) for value in dic_score.values():print(value) for item in dic_score.items():print(item) """ 字典中的各個元素是無序的,因此每次顯示的順序可能不同 添加元素 賦值語句 修改指定元素 賦值語句 合并字典 字典.update(字典) 刪除字典 pop(指定元素的關鍵字) 刪除所有元素clear() del語句 """ dic_student={'name':'張明','sex':'男'} #添加 dic_student['score']=98 print("添加元素",dic_student) #修改 dic_student['score']=90 print("修改指定元素",dic_student) #合并 dic_student.update(dic_score) print("合并字典",dic_student) #刪除指定 dic_student.pop("sex") print("刪除指定",dic_student) #刪除所以 dic_student.clear() print("刪除所以",dic_student)

集合

集合:一組無序排列的元素組成,因此不能通過下標來訪問

可變集合:創建后可以添加、修改和刪除其中的元素

不可變集合:創建后就不能再改變了

#創建 set12={1,2} print(set12) print(len(set12)) #可變集合 set_python=set("python") print(set_python) #不可變集合 frozenset_python=frozenset("python") print(frozenset_python)

課程鏈接:https://www.icourse163.org/course/XUST-1206363802?tid=1206674203

個人公眾號

總結

以上是生活随笔為你收集整理的神经网络与深度学习——TensorFlow2.0实战(笔记)(四)(python字典和集合)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。