【发布时间】:2016-02-23 16:26:35
【问题描述】:
我有一段代码没有按我的意愿输出结果。
代码
def func_a(list1):
list1.insert(2,'3')
list1.append('c')
return (list1)
def main():
list_1 = ['1','2','a','b']
list_2 = func_a(list_1)
print (list_1)
print ("\n")
print (list_2)
main()
这段代码的输出是:
['1', '2', '3', 'a', 'b', 'c']
['1', '2', '3', 'a', 'b', 'c']
我希望它是:
['1', '2', 'a', 'b']
['1', '2', '3', 'a', 'b', 'c']
【问题讨论】:
标签: python python-2.7 python-3.x