That will work unless the dict contains some objects who's repr isn't really a 
usable repr - eg <some object at 0x00000002D>.  You could even just read the 
string from the file & eval it.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of J. Merrill
Sent: Thursday, July 20, 2006 12:04 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Dict convertion question

At 01:05 AM 7/20/2006, JoeSox wrote (in part)
>File.WriteAllText(Application.StartupPath + "\\mydict.txt",
>myDict.ToCodeString()); (This results in a file size of 1,540,096 bytes
>which was created in about a second.)

I don't know much about ToCodeString, but from the name, it should produce a 
string that can be treated as Python code.  If you were to write something like
    mydict =
into the file, name the file mydict.py, and run that file -- wouldn't you end 
up with your dictionary back in a Python variable?



J. Merrill / Analytical Software Corp


_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to