Nut*_*ian 1 python concatenation
>>> arr = [ 'asdf' 'asdfsdgf' ]
>>> print arr
['asdfasdfsdgf']
Run Code Online (Sandbox Code Playgroud)
为什么有隐式字符串连接而不是SyntaxError?
相邻的字符串在Python中连接在一起:
>>> "Happy " "Birthday!"
'Happy Birthday!'
>>>
Run Code Online (Sandbox Code Playgroud)
那就是语法.您需要在列表中使用逗号分隔项目:
>>> arr = ["asdf", "asdfsdgf"]
>>> # --^
>>> arr
['asdf', 'asdfsdgf']
Run Code Online (Sandbox Code Playgroud)