?
=?iso-8859-1?q?Fran=E7ois_Pinard?=
[hokieghal99]
Quite easily. To get you started, here is an untested draft, I leave it to
you to try and debug.
import glob
for name in glob.glob('*.xls'):
if file(name, 'rb').read().find('Microsoft Excel') >= 0:
print "Found in", name
How could I use python to search for a string in binary files? From the
command line, I would do something like this on a Linux machine to find
this string:
grep -a "Microsoft Excel" *.xls
How can I do this in Python?
Quite easily. To get you started, here is an untested draft, I leave it to
you to try and debug.
import glob
for name in glob.glob('*.xls'):
if file(name, 'rb').read().find('Microsoft Excel') >= 0:
print "Found in", name