小编Rit*_*rma的帖子

如何在python中使用函数改变列表?

这是我写的描述我的问题的伪代码: -

func(s):
   #returns a value of s

x = a list of strings
print func(x)
print x #these two should give the SAME output
Run Code Online (Sandbox Code Playgroud)

当我最后打印x的值时,我希望它是func(x)返回的值.我只能通过编辑功能(并且不设置x = func(x))来执行此类操作

python function mutable

9
推荐指数
2
解决办法
8836
查看次数

标签 统计

function ×1

mutable ×1

python ×1