Re: [Tutor] can anyone help me in solving this problem this is urgent
by Shashwat Anand other posts by this author
Nov 7 2009 8:22AM messages near this date
Re: [Tutor] can anyone help me in solving this problem this is urgent
|
[Tutor] Classes that do operator overloading
naive and unoptimized method:
> >> file = open("text.txt", 'r')
> >> s = file.read()
> >> s
'an elephant jump across the room\nhe met a guy\nthe guy was an moron\n'
> >> s = " "+s.replace('\n', ' ')+" "
> >> s.count(' a ')
1
> >> s.count(' an ')
2
> >> s.count(' the ')
2
On Sat, Nov 7, 2009 at 5:54 AM, surjit khakh <surjitkhakh@[...].com> wrote:
> Write a python program to read a text file named �text.txt� and show the
> number
> of times each article is found in the file. Articles in the English
> language are the
> words �a�, �an�, and �the�.
>
> _______________________________________________
> Tutor maillist - Tutor@[...].org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
Thread:
Surjit Khakh
Emile van Sebille
Prasad Mehendale
Alan Gauld
Shashwat Anand
|