Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71443

Re: Why isn't my re.sub replacing the contents of my MS Word file?

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 <davea@davea.name>
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 <davea@davea.name>
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 <ea305e19-be61-469b-8a15-0753406f8476@googlegroups.com> <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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9944.1399965443.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Why isn't my re.sub replacing the contents of my MS Word file? scottcabit@gmail.com - 2014-05-09 12:51 -0700
  Re: Why isn't my re.sub replacing the contents of my MS Word file? MRAB <python@mrabarnett.plus.com> - 2014-05-09 21:03 +0100
    Re: Why isn't my re.sub replacing the contents of my MS Word file? scottcabit@gmail.com - 2014-05-09 13:46 -0700
  Re: Why isn't my re.sub replacing the contents of my MS Word file? Chris Angelico <rosuav@gmail.com> - 2014-05-10 06:08 +1000
  Re: Why isn't my re.sub replacing the contents of my MS Word file? Tim Chase <python.list@tim.thechases.com> - 2014-05-09 15:09 -0500
    Re: Why isn't my re.sub replacing the contents of my MS Word file? scottcabit@gmail.com - 2014-05-09 13:49 -0700
      Re: Why isn't my re.sub replacing the contents of my MS Word file? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-10 00:31 +0000
  Re: Why isn't my re.sub replacing the contents of my MS Word file? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-10 00:12 +0000
    Re: Why isn't my re.sub replacing the contents of my MS Word file? scottcabit@gmail.com - 2014-05-12 10:35 -0700
      Re: Why isn't my re.sub replacing the contents of my MS Word file? Rustom Mody <rustompmody@gmail.com> - 2014-05-12 20:00 -0700
      Re: Why isn't my re.sub replacing the contents of my MS Word file? Dave Angel <davea@davea.name> - 2014-05-12 17:15 -0400
      Re: Why isn't my re.sub replacing the contents of my MS Word file? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-13 13:49 +0000
        Re: Why isn't my re.sub replacing the contents of my MS Word file? Chris Angelico <rosuav@gmail.com> - 2014-05-13 23:55 +1000
        Re: Why isn't my re.sub replacing the contents of my MS Word file? scottcabit@gmail.com - 2014-05-13 12:01 -0700
          Re: Why isn't my re.sub replacing the contents of my MS Word file? MRAB <python@mrabarnett.plus.com> - 2014-05-13 21:26 +0100
            Re: Why isn't my re.sub replacing the contents of my MS Word file? wxjmfauth@gmail.com - 2014-05-13 23:12 -0700
              Re: Why isn't my re.sub replacing the contents of my MS Word file? alister <alister.nospam.ware@ntlworld.com> - 2014-05-14 13:21 +0000
            Re: Why isn't my re.sub replacing the contents of my MS Word file? scottcabit@gmail.com - 2014-05-14 07:40 -0700
  Re: Why isn't my re.sub replacing the contents of my MS Word file? Rustom Mody <rustompmody@gmail.com> - 2014-05-09 21:22 -0700
    Re: Why isn't my re.sub replacing the contents of my MS Word file? wxjmfauth@gmail.com - 2014-05-10 00:11 -0700
      Re: Why isn't my re.sub replacing the contents of my MS Word file? Tim Golden <mail@timgolden.me.uk> - 2014-05-10 09:49 +0100

csiph-web