Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.038 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'subject:file': 0.07; 'ascii': 0.09; 'friday,': 0.09; 'subject:Why': 0.09; 'encodings': 0.16; 'least.': 0.16; 'received:74.208.4.195': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'unicode': 0.24; 'file.': 0.24; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'work.': 0.31; 'code': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'text': 0.33; 'guess': 0.33; 'subject:the': 0.34; 'subject:?': 0.36; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'simple': 0.61; 'email addr:gmail.com': 0.63; 'more': 0.64; 'received:74.208': 0.68; 'skip:r 40': 0.68; 'good:': 0.84 Date: Mon, 12 May 2014 17:15:45 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Why isn't my re.sub replacing the contents of my MS Word file? References: <536d6f08$0$29980$c3e8da3$5496439d@news.astraweb.com> <6caea381-c765-41e7-9135-d5a0d60b7f42@googlegroups.com> In-Reply-To: <6caea381-c765-41e7-9135-d5a0d60b7f42@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:2r/Uopt3O3Xu9AYQaa9a9U2UGu0t2isWvYGm4wgxJXl ixzH4WPt5JFi5IYS2jo24D4s2tiFrtpMd02hxmvQ5Em7zME/DM N04cPuA86CrZ1RfetMbW0agcO5GSXchaUnZpYVCR+zbi9YjRjJ Mw7uXBmAyJBvAbrGvz4YFOZVL6UmRpEilTZ5RAVOfmv2CaVAq9 JnyQ+eTMpO3o9Xy18jwJAbDNeERbG7le1vXi1C/XO89z8UotMG peH6gYbpvBqWCwdfcli5hy8mtdHl4O5mcqyVDhyJb0qasMjq0+ TldjKdUymY5f0EhYJ7pAI+lEkLke2m+Ga+qOl30NboHDhXGclg lSuROzjbw/j28GimMiCE= X-Mailman-Approved-At: Tue, 13 May 2014 09:17:22 +0200 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399965443 news.xs4all.nl 2831 [2001:888:2000:d::a6]:45826 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71443 On 05/12/2014 01:35 PM, scottcabit@gmail.com wrote: > On Friday, May 9, 2014 8:12:57 PM UTC-4, Steven D'Aprano wrote: > >> Good: >> >> >> >> # Untested >> >> fStr = re.sub(b'&#x(201[2-5])|(2E3[AB])|(00[2A]D)', b'-', fStr) > > Still doesn't work. > > Guess whatever the code is for endash and mdash are not the ones I am using.... > More likely, your MSWord document isn't a simple text file. Some encodings don't resemble ASCII or Unicode in the least. -- DaveA