I googled this, seems simple af, but i'm trying some of the code and none of it is working, and I don't really feel like thinking it out.
Can somebody shoot me some code that works. Thanks!
Can somebody shoot me some code that works. Thanks!
![[Image: 9Y60Xjq.png]](https://i.imgur.com/9Y60Xjq.png)
|
Python
Remove duplicate lines from txt file? QUICK |
|
Apr 22, 2017 08:53 PM
(This post was last modified: Apr 22, 2017 10:21 PM by CaptainBlack.)
PHP Code Or simply use a set, sets in Python don't allow duplications: PHP Code
Apr 23, 2017 02:32 PM
(This post was last modified: Apr 23, 2017 02:39 PM by TheWarOwl.)
Here's a simple solution - store all of the new lines into a list and use set:
PHP Code Then you can simply write over the old file or create a new one! PHP Code There are more simple solutions and one liners, however I want you to understand the process the best you can so I've expanded it for you. 🤝 ![]() (Apr 22, 2017 07:24 PM)Woes Wrote: Hey can you PM me please I have a question about your services
This would be a way to do it with the least amount of code. It also assumes that order is not important.
PHP Code Test file: Code this is a testCode >>> unique_lines("lol.txt")SRPP Discord Server
I am a professional network/cloud security architect. My Old Tutorials |
|
|
| Possibly Related Threads... | |||
| Thread / Author | Replies | Views | Last Post |
| [.NET] by MarwenSep 24, 2022 04:19 PM | 10 | 638 |
Sep 24, 2022 04:19 PM Last Post: BinaryFox |
| [Python] by Mr. RobotSep 11, 2022 12:33 AM | 1 | 156 |
Sep 11, 2022 12:33 AM Last Post: 570RM |
| [Shell] by Cyber "Max" ShamanJan 25, 2022 08:56 PM | 3 | 185 |
Jan 25, 2022 08:56 PM Last Post: Cyber "Max" Shaman |