python - [ :] work in python? 如何

标签 python copy

它复制了一个列表,对吗?但在代码中,我正在查看我不理解的 x = x[:] 。两个副本怎么能叫同一个东西呢?

最佳答案

右边先求值,放入一个临时变量,x重新赋值给临时变量。当然,您永远看不到它。

关于python - [ :] work in python? 如何,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10273186/

相关文章:

python - 确定性问题 : set a buffer size in the CUBLAS_WORKSPACE_CONFIG environmental variable

Python - 分组依据并过滤缺少的属性值

ant - 在 Ant 中,将文件夹树中的所有文件复制到单个文件夹中?

python - graphviz Python Node Shapes - 节点中的饼图

python - Django 类型错误 : 'RelatedManager' object is not iterable

python - (matplotlib.pyplot) 散点图轴中的错误顺序

git - `git merge -s theirs` 需要但不存在

c# - 在不修改属性的情况下复制文件夹/文件?

c - 将 Char 数组附加到 Char 指针

powershell - 复制部分文件 powershell