write CSV columns out in a different order in Python

前端 未结 4 1747
猫巷女王i
猫巷女王i 2020-12-10 07:10

I realize this is very similar to this question. However, I have a CSV file that always comes in the same format that I need to write out with columns in a different order

4条回答
  •  鱼传尺愫
    2020-12-10 07:34

    reorderfunc = operator.itemgetter(4, 5, 2, 3)
    
     ...
    
    newrow = reorderfunc(oldrow)
     ...
    

提交回复
热议问题