On Saturday, May 10, 2014 1:21:04 AM UTC+5:30, scott...@gmail.com wrote: > Hi, > > > > here is a snippet of code that opens a file (fn contains the path\name) and > first tried to replace all endash, emdash etc characters with simple dash > characters, before doing a search. > > But the replaces are not having any effect. Obviously a syntax > problem....wwhat silly thing am I doing wrong?
If you are using MS-Word use that, not python. Yeah it is possible to script MS with something like this http://timgolden.me.uk/pywin32-docs/ [no experience myself!] but its probably not worth the headache for such a simple job. The VBA (or whatever is the modern equivalent) will be about as short and simple as your attempted python and making it work will be far easier. I way I used to do it with Windows-98 Word. Start a macro Do a simple single search and replace by hand Close the macro Edit the macro (VBA version) Replace the single search-n-replace with all the many you require -- https://mail.python.org/mailman/listinfo/python-list