read file to a dictionary

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu May 24 16:20:16 EDT 2007


En Thu, 24 May 2007 05:08:57 -0300, rohit <rohitsethidce at gmail.com>  
escribió:

> ohh i think i forgot to include intricate details
> in dictionary i use the following:
> value: name of a file existing on disk
> Key : a unique number assigned to each file ,with no. assigned in
> increasing order to file appearing earlier in the "english dictionary"

So you don't have to read any file at all - just scan all file names.
dict(enumerate(os.listdir(".")))

-- 
Gabriel Genellina




More information about the Python-list mailing list