Add a string to a Python list
This question already has an answer here:
Use append
:
>>> movie_list = []
>>> movie_list.append('Espas en Hollywood')
>>> movie_list
['Espas en Hollywood']
If you want to use extend
:
movie_list.append(['Espas en Hollywood'])
链接地址: http://www.djcxy.com/p/22558.html
下一篇: 将一个字符串添加到Python列表中