Python Forum
Delete multiple lines from txt file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delete multiple lines from txt file
#4
(Jul-09-2022, 06:00 PM)ibreeden Wrote: The best way to do this is:
  1. Copy the lines of the original file to a temporary file, but don't copy the lines you do not want.
  2. If no errors occurred: remove the original file.
  3. Rename the temporary file to the name of the original file.
What will be the condition for A. B. C. D.?
Reply


Messages In This Thread
Delete multiple lines from txt file - by Lky - Jul-09-2022, 04:43 PM
RE: Delete multiple lines from txt file - by Lky - Jul-10-2022, 05:32 AM
RE: Delete multiple lines from txt file - by Lky - Jul-10-2022, 05:33 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [solved] how to delete the 10 first lines of an ascii file paul18fr 7 2,123 Aug-07-2024, 08:18 PM
Last Post: Gribouillis
  Delete file with read-only permission, but write permission to parent folder cubei 6 26,082 Jun-01-2024, 07:22 AM
Last Post: Eleanorreo
  How to write the condition for deleting multiple lines? Lky 3 2,191 Jul-10-2022, 02:28 PM
Last Post: Lky
  failing to print not matched lines from second file tester_V 14 9,416 Apr-05-2022, 11:56 AM
Last Post: codinglearner
  Extracting Specific Lines from text file based on content. jokerfmj 8 5,941 Mar-28-2022, 03:38 PM
Last Post: snippsat
  Find and delete above a certain line in text file cubangt 12 7,237 Mar-18-2022, 07:49 PM
Last Post: snippsat
  How to delete portion of file already processed? Mark17 13 5,494 Jan-22-2022, 09:24 AM
Last Post: Pedroski55
  Delete multiple comments with a single API call (facebook) Ascalon 0 3,310 Dec-04-2021, 08:33 PM
Last Post: Ascalon
Question [SOLVED] Delete specific characters from string lines EnfantNicolas 4 3,413 Oct-21-2021, 11:28 AM
Last Post: EnfantNicolas
  Display table field on multiple lines, 'wordwrap' 3python 0 2,443 Aug-06-2021, 08:17 PM
Last Post: 3python

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020