Odoo中文网|Odoo实施培训

标题: 偶遇pop [打印本页]

作者: jeffrey    时间: 2018-6-20 09:00
标题: 偶遇pop
pop() 函数用于移除列表中的一个元素(默认最后一个元素),并且返回该元素的值。


#coding=utf-8

list1 = ['Google', 'Runoob', 'Taobao']
list_pop=list1.pop(1)
print "删除的项为 :", list_pop
print "列表现在为 : ", list1



删除的项为 : Runoob
列表现在为 :  ['Google', 'Taobao']






欢迎光临 Odoo中文网|Odoo实施培训 (http://www.chinaodoo.net/) Powered by Discuz! X3.2