[Tutor] FW: wierd replace problem
rwobben at hotmail.com
Mon Sep 13 20:21:18 CEST 2010
> From: rwobben at hotmail.com
> To: bgailer at gmail.com
> Subject: RE: [Tutor] wierd replace problem
> Date: Mon, 13 Sep 2010 18:19:43 +0000
>> Date: Mon, 13 Sep 2010 14:08:46 -0400
>> From: bgailer at gmail.com
>> To: tutor at python.org
>> Subject: Re: [Tutor] wierd replace problem
>> On 9/13/2010 1:50 PM, Roelof Wobben wrote:
>>> 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
>> Chapel Hill NC
>> Tutor maillist - Tutor at python.org
>> To unsubscribe or change subscription options:
> The problem as stated in the book is :
3.Write a program called alice_words.py that creates a text file named alice_words.txt containing an alphabetical listing of all the words found in alice_in_wonderland.txt together with the number of times each word occurs. The first 10 lines of your output file should look something like this:
absurd 2How many times does the word, alice, occur in the book?
The text can be found here : http://openbookproject.net/thinkcs/python/english2e/resources/ch10/alice_in_wonderland.txt
So I open the file.
Read the first rule.
This is no problem for me.
Then I want to remove some characters like ' , " when the word in the text begins with these characters.
And there is the problem. The ' and " can't be removed with replace.
So in the output you will see something like this "dark instead of dark
word is the words of the sentence which is read in from the text-file.
Am i now clear what the problem is Im facing.
More information about the Tutor