Re: [Ilugc] What data structure in python should I use

2010-01-15 Thread Kenneth Gonsalves
On Friday 15 Jan 2010 1:02:27 pm Eknath Venkataramani wrote: Works great. Much appreciated. you owe us beer and bajjis for the next LUG meet ;-) -- regards kg http://lawgon.livejournal.com ___ ILUGC Mailing List:

Re: [Ilugc] What data structure in python should I use

2010-01-15 Thread Eknath Venkataramani
The next carlsberg's on me On Fri, Jan 15, 2010 at 3:50 AM, Kenneth Gonsalves law...@thenilgiris.comwrote: you owe us beer and bajjis for the next LUG meet ;-) -- regards kg http://lawgon.livejournal.com ___ ILUGC Mailing List:

Re: [Ilugc] What data structure in python should I use

2010-01-15 Thread Eknath Venkataramani
On Fri, Jan 15, 2010 at 2:29 AM, Roshan Mathews rmath...@gmail.com wrote: Simplest things will be to just generate that file in a way you can parse. JSON is a good format. But I have no idea about PHP. I got the solution.:) ___ ILUGC Mailing

[Ilugc] What data structure in python should I use

2010-01-14 Thread Eknath Venkataramani
I have a txt file in the following format: [code] confident = { count = 4, trans = { ashahvasahta = 0.74918568, atahmavaishahvaasa = 0.09095465, pahraaram\.nbha = 0.06990729, mailatae = 0.02856427, utanai = 0.01929341, anaa = 0.01578552,

Re: [Ilugc] What data structure in python should I use

2010-01-14 Thread Balaji Abiraman
Hi, I hope dictionary feature will be more useful and relevant to this scenario. Warm Regards, Bala On Fri, Jan 15, 2010 at 10:28 AM, Eknath Venkataramani eknath.i...@gmail.com wrote: I have a txt file in the following format: [code] confident = { count = 4, trans = {

Re: [Ilugc] What data structure in python should I use

2010-01-14 Thread Roshan Mathews
On Fri, Jan 15, 2010 at 10:28 AM, Eknath Venkataramani eknath.i...@gmail.com wrote: I have a txt file in the following format: [snip] and I need to extract confident , ashahvasahta from the first record, consumers,  upabhaokahtaa from the second record... i.e. word in english and the first

Re: [Ilugc] What data structure in python should I use

2010-01-14 Thread Eknath Venkataramani
1. http://mail.python.org/mailman/listinfo/bangpypers I subscribed 2. Looks like a list of dicts, with = instead of : and [code] instead of [ ... etc. Yes. But with a variable number of possible 'meanings' 3. OT, but I'm just curious, what are you trying to do? English-Hindi machine

Re: [Ilugc] What data structure in python should I use

2010-01-14 Thread Eknath Venkataramani
I am unable to use the dictionary because of the format and the variable number of meanings for each english word I hope dictionary feature will be more useful and relevant to this scenario. ___ ILUGC Mailing List:

Re: [Ilugc] What data structure in python should I use

2010-01-14 Thread sivakumar
On Thu, 2010-01-14 at 23:58 -0500, Eknath Venkataramani wrote: I don't understand the data structure part you are asking in the subject because you already have a hash/dictonary. Did you intend to say you want to change the data structure you already have ? and I need to extract confident ,

Re: [Ilugc] What data structure in python should I use

2010-01-14 Thread Kenneth Gonsalves
On Friday 15 Jan 2010 11:23:49 am Eknath Venkataramani wrote: I am unable to use the dictionary because of the format and the variable number of meanings for each english word AFAIK python has 4 data structures - list, tuple, dictionary and set. Obviously 3 of them are of no use - so you can

Re: [Ilugc] What data structure in python should I use

2010-01-14 Thread Eknath Venkataramani
On Fri, Jan 15, 2010 at 1:24 AM, Kenneth Gonsalves law...@thenilgiris.comwrote: AFAIK python has 4 data structures - list, tuple, dictionary and set. Obviously 3 of them are of no use - so you can use a dictionary (values in a dictionary can also be lists, tuples, sets or dictionaries). btw,

Re: [Ilugc] What data structure in python should I use

2010-01-14 Thread Roshan Mathews
On Fri, Jan 15, 2010 at 11:23 AM, Eknath Venkataramani eknath.i...@gmail.com wrote: I am unable to use the dictionary because of the format and the variable number of meanings for each english word You've made a jump there. What variable number of meanings? You just had a bunch of strings

Re: [Ilugc] What data structure in python should I use

2010-01-14 Thread Kenneth Gonsalves
On Friday 15 Jan 2010 10:28:06 am Eknath Venkataramani wrote: and I need to extract confident , ashahvasahta from the first record, consumers, upabhaokahtaa from the second record... i.e. word in english and the first word in the probable-translations #!/usr/bin/python words =

Re: [Ilugc] What data structure in python should I use

2010-01-14 Thread Roshan Mathews
On Fri, Jan 15, 2010 at 12:25 PM, Eknath Venkataramani eknath.i...@gmail.com wrote: By variable I mean:  the word confident' has 8 probable meanings while consumers has only three. So I can't split the file on the basis of number of lines for each record. Simplest things will be to just

Re: [Ilugc] What data structure in python should I use

2010-01-14 Thread Eknath Venkataramani
Works great. Much appreciated. On Fri, Jan 15, 2010 at 1:52 AM, Kenneth Gonsalves law...@thenilgiris.comwrote: #!/usr/bin/python words = [{'english':confident, 'count' : 4, 'trans' : [ (ashahvasahta , 0.74918568), (atahmavaishahvaasa , 0.09095465),