Python shell不打印列表,只打印<type'list'>

Cod*_*ein -1 python shell list output

我在Python中有一个非常简单的程序,但它不会打印出shell中的列表.

该计划是:

list1 = [20]
print "list1 = ", list

def change(alist):
    alist.append(100)

change(list1)   
print "list1 = ", list
Run Code Online (Sandbox Code Playgroud)

当我在shell中尝试它时,我得到了

>>> import test
list1 =  <type 'list'>
list1 =  <type 'list'>
Run Code Online (Sandbox Code Playgroud)

如何打印列表中的实际值?

Nat*_*ath 6

你打印的list类型.要打印list1,请执行:

print "list1 = ", list1
Run Code Online (Sandbox Code Playgroud)