Python Forum
Test a file for a string without opening it?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Test a file for a string without opening it?
#1
Hi,
I have a lot of files in a directory,
Is there any good way to test a file for a string without opening it?
String =’Run Time’
If string is in file :
	do something
I hear about a function ”any” but not sure how to use it, or maybe there is a better way?

thank you in advance!
Reply


Messages In This Thread
Test a file for a string without opening it? - by tester_V - Jun-03-2020, 05:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need to replace a string with a file (HTML file) tester_V 1 778 Aug-30-2023, 03:42 AM
Last Post: Larz60+
  unittest generates multiple files for each of my test case, how do I change to 1 file zsousa 0 975 Feb-15-2023, 05:34 PM
Last Post: zsousa
  How to sort .csv file test log which item first fail and paint color SamLiu 24 4,928 Sep-03-2022, 07:32 AM
Last Post: Pedroski55
  Facing Problem while opening a file through command prompt vlearner 4 1,922 Jan-30-2022, 08:10 AM
Last Post: snippsat
  How to test and import a model form computer to test accuracy using Sklearn library Anldra12 6 3,144 Jul-03-2021, 10:07 AM
Last Post: Anldra12
  How to make a test data file for the full length of definition? MDRI 6 3,578 Apr-16-2021, 01:47 AM
Last Post: MDRI
  Subprocesses not opening File Select Dialog teut 2 2,422 Feb-22-2021, 08:07 PM
Last Post: teut
  Writing unit test results into a text file ateestructural 3 4,776 Nov-15-2020, 05:41 PM
Last Post: ateestructural
  Opening file and outputting its text content example leodavinci1990 1 1,891 Oct-12-2020, 05:33 AM
Last Post: buran
  Print a certain string only the first time it appears in a test file buttercup 5 2,802 Jul-23-2020, 01:30 PM
Last Post: palladium

Forum Jump:

User Panel Messages

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