>>>a='hello'>>>a is str>>>False???
1 回答
pardon110
TA贡献1038条经验 获得超227个赞
is在python中是比较操作符,对于字符串类型操作,基本上相当于
"x is y" 等价于 "x == y"
换而言之,字符串它比较的是内容。你可以这样
C:\Users\Administrator>python Python 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)] :: Ana conda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information. >>> a="hello" >>> a is "hello" True >>>
更详情的is用法,可执行下列语句查看或直接到官网看中文版指引
pydoc is
添加回答
举报
0/150
提交
取消