[Tutor] wierd replace problem
Joel Goldstick
joel.goldstick at gmail.com
Mon Sep 13 20:18:36 CEST 2010
On Mon, Sep 13, 2010 at 2:08 PM, bob gailer <bgailer at gmail.com> wrote:
> On 9/13/2010 1:50 PM, Roelof Wobben wrote:
>
> [snip]
>
> hello Alan,
>>
>> Your right. Then it prints like this "'tis
>> Which is not right. It must be tis.
>> So the replace does not what it supposed to do.
>>
>> Sorry but I am now more confused. After discovering no \ in the text file
> now you seem to have have a new specification, which is to get rid of the '.
>
> I suggest you give a clear, complete and correct problem statement. Right
> now we are shooting in the dark at a moving target.
>
> Something like.
>
> Given the file alice_in_wonderland.txt, copied from url so-and-so
>
> Remove these characters ...
>
> Split into words (not letters?) where word is defined as
>
> Count the frequency of each word.
>
>
> --
> Bob Gailer
> 919-636-4239
> Chapel Hill NC
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
How about using str.split() to put words in a list, then run strip() over
each word with the required characters to be removed ('`")
--
Joel Goldstick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100913/1de13c52/attachment.html>
More information about the Tutor
mailing list