Python Forum
Delete Lines that Contain Words - Loop through files in a folder - Write to new files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delete Lines that Contain Words - Loop through files in a folder - Write to new files
#3
Thank you my dear friend heiner55.

I am so happy because I have been trying for days to work out the correct syntax for this.
I guess i didnt need the lambda thing
if (any(map(lambda word: word in line, search_keywords))):

Simplicity is the best

My files have so much garbage and it was very hard for me to find these line and manually delete them one after the other Wall

Thank you so much again for lending your programming eyes and time to help me.

Python hero!

I really apreciate it so much

Hope you have a great week! Big Grin

:)



:)


Python newbie trying to learn the ropes
Reply


Messages In This Thread
RE: Delete Lines that Contain Words - Loop through files in a folder - Write to new files - by dj99 - May-13-2019, 03:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Delete file with read-only permission, but write permission to parent folder cubei 6 22,191 Jun-01-2024, 07:22 AM
Last Post: Eleanorreo
  Invalid Date Format fo Cached Files jland47 1 215 May-22-2024, 07:04 PM
Last Post: deanhystad
  Trying to generating multiple json files using python script dzgn989 4 345 May-10-2024, 03:09 PM
Last Post: deanhystad
  Filer and sort files by modification time in a directory tester_V 5 523 May-02-2024, 05:39 PM
Last Post: tester_V
  [SOLVED] Loop through directories and files one level down? Winfried 3 416 Apr-28-2024, 02:31 PM
Last Post: Gribouillis
  Loop through all files in a directory? Winfried 10 781 Apr-23-2024, 07:38 PM
Last Post: FortuneCoins
Question Right way to open files with different encodings? Winfried 2 406 Apr-23-2024, 05:50 PM
Last Post: snippsat
  Open files in an existing window instead of new Kostov 2 458 Apr-13-2024, 07:22 AM
Last Post: Kostov
  Using zipfile module - finding folders not files darter1010 2 441 Apr-06-2024, 07:22 AM
Last Post: Pedroski55
  Is it possible to extract 1 or 2 bits of data from MS project files? cubangt 8 1,250 Feb-16-2024, 12:02 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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