[Tutor] Problem with data storage

Olli Rajala olli.s.rajala at tut.fi
Thu Dec 2 10:56:59 CET 2004


> ###Reader
> aDict={}
> for line in aFile:
>     key,value=line.strip().split("=")
>     aDict[key]=value

Hmm, in my photogallery, I have data organized as number:value-pairs
(one/line) and I can have ':' in value, so I use line.split(":", 1) to
split it just from the first ':'. It works in my system, but as I'm
not very seasoned programmer, don't know if it's the right way to do
it... :)

Yours, 
-- 
Olli Rajala
http://www.students.tut.fi/~rajala37/

"In theory, Theory and Practice should be
the same. But in practice, they aren't."
- Murphy's Proverbs


More information about the Tutor mailing list