[Tutor] Help on reading a plain file of names

Tiago Cunha tiagotmc at gmail.com
Fri Mar 11 19:26:01 CET 2011

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.gauld at btinternet.com>wrote:

> "apple owner" <smerkyd at 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 at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110311/2fe84689/attachment.html>

More information about the Tutor mailing list