如何在for循环期间修改列表条目? - How to modify list entries during for loop?

问题:

Now I know that it is not safe to modify the list during an iterative looping.现在我知道在迭代循环期间修改列表是不安全的。 However, suppose I have a list of strings, and I want to strip the strings themselves.但是,假设我有一个字符串列表,并且我想剥离这些字符串本身。 Does replacement of mutable values count as modification?替换可变值算作修改吗?


解决方案:

参考一: https://en.stackoom.com/question/H7i5
参考二: https://stackoom.com/question/H7i5
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章