I would suggest to use the NLTK package. Try methods like nltk.endswith() or nltk.startswith()
On Fri, Mar 11, 2011 at 5:36 AM, Alan Gauld <alan.ga...@btinternet.com>wrote: > "apple owner" <smer...@aol.com> wrote > > > I am new to python and I am trying to open a plain >> text file of names and to see the number of names >> that start with specific letters and display them >> in a bar graph. >> > > OK, Lets break that down so that we can understand > what exactly puzzles you: > > 1) Can you open a text file and read it? > 2) Can you figure out if a string(a name) startwith a specific latter? > 3) Can you build a collection based ion the starting letter - a dictionary > maybe? > 4) Can you display the dictionary keys and values on a graph? > > Can you try to solve each part of the problem separately > and then put the pieces together for your final solution? > > Try posting back with specific questions and example code > where you have tried to solve the problem. That makes it > easier for us to se where you are having trouble. > > HTH, > > -- > Alan Gauld > Author of the Learn to Program web site > http://www.alan-g.me.uk/ > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor