Enumerating words and Adding integer, character and string
Robert Brewer
fumanchu at amor.org
Sat Mar 6 02:01:51 EST 2004
dont bother wrote:
> > 1. How do I make a vector of words in a file.
> > I want to have this file:
> > 1 Alpha
> > 2 Beta
> > 3 Gamma
> >
> > I just dont want to write it/print it instead I want a
> > mapping. A vector kind of thing whose first attribute
> > is interger second is the 'word'
>>> dict([(index + 1, line.strip()) for index, line in
enumerate(open(r"C:\words.txt"))])
{1: 'Alpha', 2: 'Beta', 3: 'Gamma'}
Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org
More information about the Python-list
mailing list