Search
 
SCRIPT & CODE EXAMPLE
 

HTML

Search CSV files for text

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import csv, os, glob
#input keywords to  search
keywords = ('113006249')
 
path = r'F:Attachments*.csv'
 
for Tname in glob.glob(path):
     
    #read csv, and split on "," the line
    csv_file = csv.reader(open(Tname, "r", encoding='utf-8'), delimiter=",")
 
    #loop through the csv list
    for row in csv_file:
        with open(r'F:AttachmentsResults
esults.txt', 'w') as f:
            if keywords == row[0]:
            # print(row)  If i just print the results out to the console, i get what i need
            # print (os.path.basename(Tname))  If i just print the results out to the console, i get what i need
 
 
                f.write(' '.join(row))  but when i try to write the results to a file, i dont get anything
                #f.write(os.path.basename(Tname))  this is also something i need in the file so we know what attachment the number was found in
Comment

PREVIOUS NEXT
Code Example
Html :: niklas von hertzen html2canvas textarea capture only one line 
Html :: where to store nft art 
Html :: netlify 11ty build configuration 
Html :: como hacer un boton flotante de volver arriba en html 
Html :: how to set image in input type=file by jquery 
Html :: nigeria naira code 
Html :: h-card 
Html :: tailwind tag input 
Html :: svm e1071 cutoff 
Html :: difference between index, follow or follow 
Html :: change api date 
Html :: Save current page as HTML to server 
Html :: alpine extract data to script tag 
Html :: cara mengatur ukuran gambar navbar-brand 
Html :: animate image or text html 
Html :: bootstrap dropright overflow issue 
Html :: html peseta symbol 
Html :: angular html conditional text 
Html :: autoplay controls html5 
Html :: fa fa hand down 
Html :: html tag link tittle bar 
Html :: twig raw in controller 
Html :: klaviyo.js snippet 
Html :: how to extract img tag in cherio 
Html :: pass parameter 2 html button 
Html :: typo3 params lost pagination 
Html :: what is merge strategy? 
Html :: overlay text input html 
Html :: asp display object list in table 
Html :: aria-describedby and role 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =