[Tutor] Extract from Word Doc

John Fouhy john at fouhy.net
Tue Nov 28 22:54:15 CET 2006


On 29/11/06, Steve Nelson <sanelson at gmail.com> wrote:
> Hello,
>
> Is there a way to pull "strings" out of a word document?  Not unlike
> the way the UNIX command "strings" does?

Here's a crude attempt:

>>> import string
>>> s = file('myworddoc.doc').read()
>>> t = ''.join(c for c in s if c in
string.letters+string.digits+string.punctuation+string.whitespace)

-- 
John.


More information about the Tutor mailing list