python-NO.1

因为还在看书阶段,对很多概念不是太理解,先把这些有疑问的地方记录下来,方便以后学习。  

Q1.python中的isinstance()与type(a)==type(b){比较对象的值}以及type(a) is type(b){比较内存地址}有什么关系?

>>> a=3
>>> b=4
>>> type(a)==type(4)
True
>>> type(a) is type(b)
True
>>> print(type(a))
<class 'int'>
>>> print(type(b))
<class 'int'>
>>> id(type(a))
505668504
>>> id(type(b))
505668504


Q2.如果我要查询isinstance的功能,我只有在document中查询么?能否在命令行中通过操作help来得到?

>>> help(a.isinstance())
<span style="color:#ff6666;">Traceback (most recent call last):
  File "<pyshell#17>", line 1, in <module>
    help(a.isinstance())
AttributeError: 'int' object has no attribute 'isinstance'</span>
这怎么解决?

今天的收获:对python的几种类型进行分类,按照存储,取值,更改三种方式。字符串,数值,元组,列表,字典在于我来说不再是一个个单一的部分,而是交叉联系,帮助我回忆了数据结构里面的知识。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值