您的位置:首页 > 编程语言 > Python开发

python类中属性逗号引发的类型改变

2017-04-24 16:12 274 查看
不注意点了个逗号引发了类型改变

[shangbl@newsvn ~]$ cat test.py
class AB1:
a="a"

class AB12:
a="a",

print(type(AB1.a))
print(type(AB12.a))
[shangbl@newsvn ~]$ python test.py
<type 'str'>
<type 'tuple'>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: