My Big Dict.

Russell Reagan rreagan at
Wed Jul 2 10:04:26 CEST 2003

"drs" <drs at> wrote

> f = open('somefile.txt')
> d = {}
> l = f.readlines()
> for i in l:
>     a,b = i.split('!')
>     d[a] = b.strip()

I have just started learning Python, and I have never used dictionaries in
Python, and despite the fact that you used mostly non-descriptive variable
names, I can still read your code perfectly and know exactly what it does. I
think I could use dictionaries now, just from looking at your code snippet.
Python rules :-)

More information about the Python-list mailing list