Regex for strings utility
nde at comp.leeds.ac.uk
Wed Jul 18 12:53:29 CEST 2001
On Tue, 17 Jul 2001 19:07:59 GMT, rhys tucker <rhystucker at yahoo.com> wrote:
> I'm trying to write a script which operates like the Unix 'strings'
> utility but I'm having difficulties with the regex.
> #!/usr/bin/env python
> # strings program
> import sys, re
> f = open(sys.argv)
> line = f.readline()
This isn't answering your regex question but...
You're opening a text file and reading it line-by-line
here, which probably isn't what you want if you are
trying to duplicate the behaviour of 'strings' exactly.
f = open(sys.argv, 'rb')
data = f.read()
might be better.
More information about the Python-list