Re: loading dictionary from a file

2008-02-07 Thread Fuzzyman
Amit Gupta wrote: > Need a python trick, if it exists: > > I have a file that stores key, value in following format > -- > "v1" : "k1", > "v2" : "k2" > -- > > Is there a way to directly load this file as dictionary in python. I > could do (foreach line in file, split by ":" and then do dictionary

Re: loading dictionary from a file

2008-02-06 Thread Adonis Vargas
Amit Gupta wrote: > Need a python trick, if it exists: > > I have a file that stores key, value in following format > -- > "v1" : "k1", > "v2" : "k2" > -- > > Is there a way to directly load this file as dictionary in python. I > could do (foreach line in file, split by ":" and then do dictionary

Re: loading dictionary from a file

2008-02-06 Thread Amit Gupta
On Feb 6, 5:33 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > Amit Gupta <[EMAIL PROTECTED]> writes: > > Need a python trick, if it exists: > > > I have a file that stores key, value in following format > > -- > > "v1" : "k1", > > "v2" : "k2" > > -- > > > Is there a way to directly load this file as d

Re: loading dictionary from a file

2008-02-06 Thread Ben Finney
Amit Gupta <[EMAIL PROTECTED]> writes: > Need a python trick, if it exists: > > I have a file that stores key, value in following format > -- > "v1" : "k1", > "v2" : "k2" > -- > > Is there a way to directly load this file as dictionary in python. That input looks almost like valid JSON http://j

Re: loading dictionary from a file

2008-02-06 Thread Miki
Hello Amit, > Need a python trick, if it exists: > > I have a file that stores key, value in following format > -- > "v1" : "k1", > "v2" : "k2" > -- > > Is there a way to directly load this file as dictionary in python. I > could do (foreach line in file, split by ":" and then do dictionary > inse

loading dictionary from a file

2008-02-06 Thread Amit Gupta
Need a python trick, if it exists: I have a file that stores key, value in following format -- "v1" : "k1", "v2" : "k2" -- Is there a way to directly load this file as dictionary in python. I could do (foreach line in file, split by ":" and then do dictionary insert). Wondering, if some python bu