replacing items in nested lists python

前端 未结 5 1366
死守一世寂寞
死守一世寂寞 2021-01-16 07:04

I am trying to make a duplicate list of lists and change one element to another within the nested lists of the duplicate list but am having some trouble. How I made the dup

5条回答
  •  余生分开走
    2021-01-16 07:54

    order_1 = []
    for item in order:
        temp = []
        for i in item:
            if i=="F":
                temp.append("R")
            elif i=="R"
                temp.append("F")
            else:
                temp.append(i)
        order_1.append(temp)
    

提交回复
热议问题