全部分类
移动开发与应用
WEB前端
架构与运维
程序设计
数据库
操作系统
热点技术
综合
==等号判断运算符使用失效
1233阅读 0评论
2012-09-12
wdove
分类:
Python/Ruby
E.g:
soc_id = soc_type[2:]
if soc_id in [61, 63]:
print soc_id
soc_id将不会被打印,这是因为soc_id是string, 必须先使用int(soc_id)才行。
这里的教训是python中虽然没有类型声明,但变量类型在第一次赋值时已经确定了。
上一篇:
Error of "No module named xxx"
下一篇:
在python中使用*, ?通用匹配符