찾다

 >  Q&A  >  본문

python删除id相同的行

有个文件的结构如下
The Cunctator 334555717

64.38.175.xxx 334555718

The Cunctator 334555718

The Cunctator 334555720

The Cunctator 334555721

AxelBoldt 334555723

The Cunctator 334555723

对于相同的id而言,我只需要保存最后一个id的数据,请问该怎么用python处理。比如上面的结果应该为:
The Cunctator 334555717

The Cunctator 334555718

The Cunctator 334555720

The Cunctator 334555721

The Cunctator 334555723

PHP中文网PHP中文网2888일 전326

모든 응답(2)나는 대답할 것이다

  • ringa_lee

    ringa_lee2017-04-17 17:36:13

    Loop, id는 사전, traverse의 키로 사용됩니다

    회신하다
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:36:13

    으아악

    모바일 코딩은 테스트되지 않았습니다

    회신하다
    0
  • 취소회신하다