python - Comparing keywords in a page or CSV file: PHP ? Bash? -


i have series of keywords in html web page - comma separated them csv, , know ones notin csv file displayed html web page. how comparison ? have ideas mysql , tables csv or html sources. !

in python, given 2 csv files, a.csv , b.csv, script create (or edit if exists) new file out.csv contains in a.csv that's not found in b.csv.

import urllib  url = 'http://www.website.com/x.csv' urllib.urlretrieve(url, 'b.csv')   file_a = open('a.csv', 'r') file_b = open('b.csv', 'r')     file_out = open('out.csv', 'w')  list_a = [x.strip() x in file_a.read().split(',')] list_b = [x.strip() x in file_b.read().split(',')]     list_out = list(set(list_a) - set(list_b)) # reverse if necessary  file_out.write(','.join(list_out)) file_out.close() 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -