从我所知的很少,+ op for lists只需要第二个操作数可迭代,"ha"显然是.
在代码中:
>>> x = []
>>> x += "ha"
>>> x
['h', 'a']
>>> x = x + "ha"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can only concatenate list (not "str") to list
Run Code Online (Sandbox Code Playgroud)