蟒蛇。传递给函数时列表是否被视为全局?

时间:2016-12-29 06:59:50

标签: python list

keeplist1= ['GenderDesc','MartialStatusDesc','castegroup']
dummylist1= 'castegroup'

def funky(keeplist,dummylist):

        keeplist.remove(dummylist)
        print keeplist

funky(keeplist1,dummylist1)

输出:[' GenderDesc',' MartialStatusDesc']

print keeplist1

输出:[' GenderDesc',' MartialStatusDesc']

两个print语句都提供相同的输出。这是预期的行为吗?

0 个答案:

没有答案