- Learn Programming in Python with Cody Jackson
- Cody Jackson
- 145字
- 2021-06-10 19:06:11
Dictionary details
There are a few key points about dictionaries that you should be aware of:
- Sequence operations don't work. As previously stated, dictionaries are mappings, not sequences. Because there's no order to dictionary items, functions such as concatenation and slicing don't work.
- Assigning new indexes adds entries. Keys can be created when making a dictionary (that is, when you initially create the dictionary) or by adding new values to an existing dictionary. The process is similar and the end result is the same.
- Keys can be anything immutable. The previous examples showed keys as string objects, but any non-mutable object (such as numbers) can be used for a key. Numbers can be used to create a list-like object but without the ordering. Tuples are sometimes used to make compound keys; class instances that are designed not to change can also be used if needed.
推薦閱讀
- AngularJS Testing Cookbook
- C和C++安全編碼(原書第2版)
- Dependency Injection in .NET Core 2.0
- 數(shù)據(jù)結(jié)構(gòu)簡明教程(第2版)微課版
- Web Application Development with MEAN
- Symfony2 Essentials
- Getting Started with React Native
- Visualforce Developer’s guide
- 輕松上手2D游戲開發(fā):Unity入門
- Python程序設(shè)計(jì)與算法基礎(chǔ)教程(第2版)(微課版)
- Lift Application Development Cookbook
- Java Web應(yīng)用開發(fā)給力起飛
- 深入解析Java編譯器:源碼剖析與實(shí)例詳解
- 石墨烯改性塑料
- JavaScript Concurrency