python __builtins__ dict类 (17)
17、'dict', 用于创建一个字典。
- class dict(object)
- | dict() -> new empty dictionary
# 空字典- | dict(mapping) -> new dictionary initialized from a mapping object's
- | (key, value) pairs
# dict([('one', 1), ('two', 2)])- | dict(iterable) -> new dictionary initialized as if via:
- | d = {}
- | for k, v in iterable:
- | d[k] = v
- | dict(**kwargs) -> new dictionary initialized with the name=value pairs
- | in the keyword argument list. For example: dict(one=1, two=2)
- |
- | Methods defined here:
- |
- | __contains__(self, key, /)
- | True if D has a key k, else False.
- |
- | __delitem__(self, key, /)
- | Delete self[key].
- |
- | __eq__(self, value, /)
- | Return self==value.
- |
- | __ge__(self, value, /)
- | Return self>=value.
- |
- | __getattribute__(self, name, /)
- | Return getattr(self, name).
- |
- | __getitem__(...)
- | x.__getitem__(y) <==> x[y]
- |
- | __gt__(self, value, /)
- | Return self>value.
- |
- | __init__(self, /, *args, **kwargs)
- | Initialize self. See help(type(self)) for accurate signature.
- |
- | __iter__(self, /)
- | Implement iter(self).
- |
- | __le__(self, value, /)
- | Return self<=value.
- |
- | __len__(self, /)
- | Return len(self).
- |
- | __lt__(self, value, /)
- | Return self<value.
- |
- | __ne__(self, value, /)
- | Return self!=value.
- |
- | __new__(*args, **kwargs) from builtins.type
- | Create and return a new object. See help(type) for accurate signature.
- |
- | __repr__(self, /)
- | Return repr(self).
- |
- | __setitem__(self, key, value, /)
- | Set self[key] to value.
- |
- | __sizeof__(...)
- | D.__sizeof__() -> size of D in memory, in bytes
- |
- | clear(...)
- | D.clear() -> None. Remove all items from D.
- |
- | copy(...)
- | D.copy() -> a shallow copy of D
- |
- | fromkeys(iterable, value=None, /) from builtins.type
- | Returns a new dict with keys from iterable and values equal to value.
- |
- | get(...)
- | D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
- |
- | items(...)
- | D.items() -> a set-like object providing a view on D's items
- |
- | keys(...)
- | D.keys() -> a set-like object providing a view on D's keys
- |
- | pop(...)
- | D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
- | If key is not found, d is returned if given, otherwise KeyError is raised
- |
- | popitem(...)
- | D.popitem() -> (k, v), remove and return some (key, value) pair as a
- | 2-tuple; but raise KeyError if D is empty.
- |
- | setdefault(...)
- | D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
- |
- | update(...)
- | D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
- | If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
- | If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
- | In either case, this is followed by: for k in F: D[k] = F[k]
- |
- | values(...)
- | D.values() -> an object providing a view on D's values
- |
- | ----------------------------------------------------------------------
- | Data and other attributes defined here:
- |
- | __hash__ = None
python __builtins__ dict类 (17)的更多相关文章
- python __builtins__ type类 (69)
69.'type', 返回对象类型 class type(object) | type(object_or_name, bases, dict) | type(object) -> the ob ...
- python __builtins__ staticmethod类 (64)
64.'staticmethod', 返回静态方法 class staticmethod(object) | staticmethod(function) -> method | | Conve ...
- python __builtins__ memoryview类 (46)
46.'memoryview', 返回给定参数的内存查看对象(Momory view).所谓内存查看对象,是指对支持缓冲区协议的数据进行包装,在不需要复制对象基础上允许Python代码访问. cla ...
- python __builtins__ help类 (32)
32.'help', 接收对象作为参数,更详细地返回该对象的所有属性和方法 class _Helper(builtins.object) | Define the builtin 'help'. | ...
- python __builtins__ float类 (25)
25.'float', 用于将整数和字符串转换成浮点数. class float(object) | float(x) -> floating point number | | Convert ...
- python __builtins__ classmethod类 (11)
11.'classmethod', 修饰符对应的函数不需要实例化,不需要 self 参数,但第一个参数需要是表示自身类的 cls 参数,可以来调用类的属性,类的方法,实例化对象等. class cla ...
- python __builtins__ bool类 (6)
6.'bool', 函数用于将给定参数转换为布尔类型,如果没有参数,返回 False. class bool(int) # 继承于int类型 | bool(x) -> bool # 创建boo ...
- python __builtins__ zip类 (71)
71.'zip' , 函数用于将可迭代的对象作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的列表.如果各个迭代器的元素个数不一致,则返回列表长度与最短的对象相同,利用 * 号操作 ...
- python __builtins__ tuple类 (68)
68.'tuple', 转换为元组类型 class tuple(object) | tuple() -> empty tuple | tuple(iterable) -> tuple in ...
随机推荐
- Solidworks修改零件文件名之后工程图找不到零件怎么办
如下图所示,如果我直接把"压紧柱 V1.0"改名为"压紧柱",则打开工程图之后图纸都没了. 即便你用打开零件的方式找到了这个零件,工程图还是老样子 所以 ...
- HDU 2317 Nasty Hacks
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- [转载]C函数的实现(strcpy,atoi,atof,itoa,reverse)
在笔试面试中经常会遇到让你实现C语言中的一些函数比如strcpy,atoi等 1. atoi 把字符串s转换成数字 int Atoi( char *s ) { , i = ; ; ; isspace( ...
- iOS xmpp协议实现聊天之openfire的服务端配置(一)
今天弄这个openfire服务端的配置直接苦了一逼,只是好在最后最终配置好了.首先感谢@月光的尽头的博客给了我莫大的帮助. 切入正题,首先说一下iOS xmpp协议实现聊天openfireserver ...
- 微软下一代站点开发框架:ASP.NET MVC 6 新特性揭秘
国内第一个<微软下一代站点开发框架:ASP.NET MVC 6 新特性揭秘 >课程 微软特邀讲师 徐雷!周六晚8点YY预定:id=28447" href="htt ...
- 【转】使用git 工具下载android.jar Source Code
为了开发android应用,在开发时发现sdk没有源代码,这样在开发时太麻烦了,下面说说如何下载源代码,以及如何配置. 下载源代码需要git,先下载一个git.下面的操作都是在windows下完成的. ...
- react native camera
最近在尝试用react native camera iOS版本很方便就调试通过了,react的试用非常方便 android版本要单独试用fork的 屏蔽了lint的报错后也可以调试通过 参考这篇文章填 ...
- SQL Server 数据库备份策略,第一周运行失败的原因
一般生产库,采用 每10分钟备份Log,每天备份Diff,每周备份Full的策略. 同时存在异地备份.异地备份可使用SQL Server本身的cmdshell存储过程,调用系统命令. 在为新数据库,建 ...
- Git 对比两分支中同一文件
语法 git diff <分支名> <分支名> -- 文件名 git diff branch1 branch2 -- path/file.txt 案例 git diff ori ...
- 第一次通过AVD Manager创建了一个虚拟设备,但是在Android Studio运行程序时却无设备可选
第一次通过AVD Manager创建了一个虚拟设备,但是在Android Studio运行程序时却无设备可选 原因是adb.exe未运行起来 至于adb.exe未正常运行起来的原因多半是5037端口被 ...