这里以Python3为例python
helloworld
1 print("hello" + "world")hello world
1 print("hello", "world")
这里发现加号的做用是链接字符串 而逗号至关于用空格链接字符串。spa
TypeError: must be str, not int
1 print("hello" + 123)hello 123
1 print("hello", 123)
这里发现加号在Str类型与Num类型相加的出现了类型错误 逗号链接正常并返回字符串结果。code
加号 + :两边只能是相同数据类型,在Python中主要是运算符的存在,而字符串等类型相加只是Python中的内置方法。
逗号 , : 在这里逗号更多的表明用空格的链接。