Python Forum
program that search string in text file and do something
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
program that search string in text file and do something
#1
Hi, I'm new to thing forum and to this programming in python!

can someone help me and write me how to write a program that do:
- search for a string in certain text file and if it founds the string it delete the file? and print something?

thanks.

my code here
Reply
#2
Hi, alon30, and welcome to the forum. While we are willing to help, we are not going to do this for you. You need to show us your best attempt, i.e. post your code (in code tags) and ask specific questions regarding problems you are not able to solve. The best approach would be to split the task in smaller parts/steps and approach these one by one
for start you may want to check our tutorials for working with files
https://python-forum.io/Thread-Basic-Files
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Split string into 160-character chunks while adding text to each part iambobbiekings 9 9,583 Jan-27-2021, 08:15 AM
Last Post: iambobbiekings
  Reading a text until matched string and print it as a single line cananb 1 2,017 Nov-29-2020, 01:38 PM
Last Post: DPaul
  Appending to a text string syno7878 10 4,240 May-03-2020, 10:05 AM
Last Post: snippsat
  Using an integer to manipulate a string/text variable rexyboy2121 1 1,734 Apr-22-2020, 01:37 AM
Last Post: michael1789
  Trying to extract Only the capitol letters from a string of text Jaethan 2 2,169 Feb-27-2020, 11:19 PM
Last Post: Marbelous
  Convert text from an image to a text file Evil_Patrick 5 4,268 Jul-30-2019, 07:57 PM
Last Post: DeaD_EyE
  reading text file and writing to an output file precedded by line numbers kannan 7 10,369 Dec-11-2018, 02:19 PM
Last Post: ichabod801
  How to find exact matching string from the text desul 5 4,094 Apr-17-2017, 04:31 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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