2004年02月25日 星期三 14:42
很弱的问题:
输入
type({}),
屏幕输出
但是输入
type({})==" "
屏幕却输出 False
为什么会这样那?
我用的是activepython2.3+win2k
lilin
lin.li at samsung.com
Python is designed to save time
2004年02月25日 星期三 14:43
这是python在告诉你这是一个“字典”对象, 而" " 则是一个字符串,他们当然不一样了。 -----原始邮件----- 发件人: Lilin [mailto:lin.li at samsung.com] 发送时间: 2004年2月25日 14:42 收件人: python-chinese at lists.python.cn 主题: [python-chinese] about type() 很弱的问题: 输入 type({}), 屏幕输出 但是输入 type({})==" " 屏幕却输出 False 为什么会这样那? 我用的是activepython2.3+win2k lilin lin.li at samsung.com Python is designed to save time
2004年02月25日 星期三 14:46
值不同,当然不等啦
type({}),type对象
"" 字符串
>From: Lilin <lin.li at samsung.com>
>To: python-chinese at lists.python.cn
>Subject: [python-chinese] about type()
>Date: Wed, 25 Feb 2004 14:42:03 +0800
>
>很弱的问题:
>输入
>type({}),
>屏幕输出
>
>但是输入
>type({})==" "
>屏幕却输出 False
>为什么会这样那?
>我用的是activepython2.3+win2k
>
>lilin
>lin.li at samsung.com
>Python is designed to save time
>_______________________________________________
>python-chinese mailing list
>python-chinese at lists.python.cn
>http://python.cn/mailman/listinfo/python-chinese
_________________________________________________________________
免费下载 MSN Explorer: http://explorer.msn.com/lccn/
2004年02月25日 星期三 14:55
>>> type(1) == int
True
>>> type({}) == dict
True
>>> import types
>>> type({}) == types.DictType
True
>>> type({}) is types.DictType
True
-----Original Message-----
From: python-chinese-bounces at lists.python.cn
[mailto:python-chinese-bounces at lists.python.cn] On Behalf Of Lilin
Sent: Wednesday, February 25, 2004 2:42 PM
To: python-chinese at lists.python.cn
Subject: [python-chinese] about type()
很弱的问题:
输入
type({}),
屏幕输出
但是输入
type({})==" "
屏幕却输出 False
为什么会这样那?
我用的是activepython2.3+win2k
lilin
lin.li at samsung.com
Python is designed to save time
2004年02月25日 星期三 17:18
str(type({}))=="" True
type({})==" " False
IDLE输出的是str(_);
----- Original Message -----
From: "Lilin" <lin.li at samsung.com>
To: <python-chinese at lists.python.cn>
Sent: Wednesday, February 25, 2004 2:42 PM
Subject: [python-chinese] about type()
> 很弱的问题:
> 输入
> type({}),
> 屏幕输出
>
> 但是输入
> type({})==" "
> 屏幕却输出 False
> 为什么会这样那?
> 我用的是activepython2.3+win2k
>
> lilin
> lin.li at samsung.com
> Python is designed to save time
--------------------------------------------------------------------------------
> _______________________________________________
> python-chinese mailing list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
>
2004年02月25日 星期三 17:46
>>>type({})
>>>type( type({}) )
>>>type(" ")
原来type()返回值是type类型的,不是字符串型的。
----- Original Message -----
From: "Lilin" <lin.li at samsung.com>
To: <python-chinese at lists.python.cn>
Sent: Wednesday, February 25, 2004 2:42 PM
Subject: [python-chinese] about type()
> 很弱的问题:
> 输入
> type({}),
> 屏幕输出
>
> 但是输入
> type({})==" "
> 屏幕却输出 False
> 为什么会这样那?
> 我用的是activepython2.3+win2k
>
> lilin
> lin.li at samsung.com
> Python is designed to save time
--------------------------------------------------------------------------------
> _______________________________________________
> python-chinese mailing list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
>
Zeuux © 2025
京ICP备05028076号