I have the code below which needs modification: I need the output file changing so it doesnt record the filenames of 0 finds: only the positive hits as listed.
for info: the csv contains keywords, the script will search through a folder of files and record how many instances of each keyword appears and output to a text file.
---
from os import walk;
import os;
import re;
import sys
if len([login to view URL]) != 2:
print 'Please pass the path of the folder as command line argument.';
print 'Usage: ' + [login to view URL](__file__) + ' <folder>';
print 'Example: ' + [login to view URL](__file__) + ' /tmp';
[login to view URL](0);
keywords_file = open('[login to view URL]', 'r+');
keywords_csv = [login to view URL]();
[login to view URL]();
keywords = [login to view URL](',');
outfile = open('[login to view URL]', 'w');
for (dirpath, dirnames, filenames) in walk([login to view URL][1]):
print '<<<' + dirpath + '>>>';
[login to view URL]('<<<' + dirpath + '>>>' + '\n');
for filename in filenames:
# if [login to view URL]('.html') or [login to view URL]('.php'):
print '[ ' + dirpath + '/' + filename + ' ]';
[login to view URL]('[ ' + dirpath + '/' + filename + ' ]' + '\n');
file = open(dirpath + '/' + filename);
content = [login to view URL]();
for keyword in keywords:
list = [login to view URL](keyword, content);
count = len(list);
print keyword + ': ' + str(count);
[login to view URL](keyword + ': ' + str(count) + '\n');
[login to view URL]();
[login to view URL]();
---
Heya.
Interesting script. I notice there are different styles of code between the top and bottom. I have made the changes to your script and tested it.
Waiting for your feedback.
Highly interested with your project and im ready to start right now. My completion rate is always 100% and I only bite what I can chew. knock me please . you will also find me in Skyp: pewqil
Hi,
I'm a master student majoring in data analytics with an expertise of python coding. I take class at night so I will be all available in daytime. Hope I can work for you. Thanks.
I have been working as a software developer for more than one and half year on python scripting and having good knowledge on algorithms and data structures and file handling