python是强类型的语言,不是脚本语言就一定是弱类型语言。看Python与Javascript的对比。
Python强类型:不同类型不能够进行运算。
>>> 3+6
9
>>> "3"+6
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Can't convert 'int' object to str implicitly
>>> "3"+"6"
'36'
>>> "6"-"3"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for -: 'str' and 'str'
------------------------------------------------------------
Javascript弱类型:不同类型可以进行运算。
3+6
9
"3"+6
"36"
"3"+"6"
"36"
"6"-"3"
3