Heim >Backend-Entwicklung >Python-Tutorial >python通过加号运算符操作列表的方法

python通过加号运算符操作列表的方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-10 15:08:311692Durchsuche

本文实例讲述了python通过加号运算符操作列表的方法。分享给大家供大家参考。具体如下:

li = ['a', 'b', 'mpilgrim']
li = li + ['example', 'new']
print li 
li += ['two']
print li 

运行结果如下:

['a', 'b', 'mpilgrim', 'example', 'new']
['a', 'b', 'mpilgrim', 'example', 'new', 'two']

希望本文所述对大家的Python程序设计有所帮助。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn