Skip to main content
 首页 » 编程设计

python之为什么 "append(' w')"返回无

2025年05月04日22Leo_wl

<分区>

这是我的代码:

def list_test(foo): 
    bar = foo.append('w') 
    return bar 
 
my_input = [7,8,9] 

当我运行它时:

>>>print list_test(my_input) 
None 

打印输出 None。为什么?我该如何解决?

注意:我需要的输出是:7,8,9,'w'

谢谢。