Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wintersolid/py_keysearch
https://github.com/wintersolid/py_keysearch
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/wintersolid/py_keysearch
- Owner: WinterSolid
- Created: 2024-03-25T21:06:27.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-03-25T22:48:06.000Z (9 months ago)
- Last Synced: 2024-03-26T22:27:06.915Z (9 months ago)
- Language: Java
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Py_KeySearch
## About
This code defines a function search_keywords_in_files that searches for a set of keywords in all files within a specified directory.
It returns a list of tuples containing the filename, line number, and line content where each keyword is found.## To use this code
- replace '/path/to/your/files' with the directory containing the files you want to search in, and {'keyword1', 'keyword2', 'keyword3'} with the set of keywords you want to search for.When you run this script, it will print out each occurrence of the keywords along with the filename and line number where they were found.
## To run the search_keywords_in_files script, you need to follow these steps:
- Save the Script: First, save the Python script containing the search_keywords_in_files function to a file
Navigate to the Directory Containing Your Script: Open a Terminal or Command Prompt and navigate to the directory containing keyword_search.py using the cd command.
Run the Script: Once you're in the correct directory, you can run the Python script by typing:>> python keyword_search.py