Re: [BangPypers] How should I do it?

2010-01-15 Thread Noufal Ibrahim
On Fri, Jan 15, 2010 at 1:04 PM, Dhananjay Nene dhananjay.n...@gmail.comwrote: This seems to be an output of print_r of PHP. If you have a flexibility, try to have the PHP code output the data into a language neutral format (eg json, yaml, xml etc.) and then parse it in python using the

Re: [BangPypers] How should I do it?

2010-01-15 Thread Kenneth Gonsalves
On Friday 15 Jan 2010 12:01:56 pm 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: [BangPypers] How should I do it?

2010-01-15 Thread Roshan Mathews
On Fri, Jan 15, 2010 at 2:40 PM, Anand Balachandran Pillai abpil...@gmail.com wrote:    # Now, count and trans are not strings in    # data, so Python will complain, hence we    # define these as strings with same name!    count, trans = 'count','trans' Clever, that. I got to there, threw up

Re: [BangPypers] How should I do it?

2010-01-15 Thread Baishampayan Ghose
It is a clever hack, taking advantage of the nature of the data. But it is far more faster than the other approaches posted here. I thought eval was evil :) Regards, BG -- Baishampayan Ghose b.ghose at gmail.com ___ BangPypers mailing list

Re: [BangPypers] How should I do it?

2010-01-15 Thread Anand Chitipothu
On Fri, Jan 15, 2010 at 4:00 PM, Baishampayan Ghose b.gh...@gmail.com wrote: It is a clever hack, taking advantage of the nature of the data. But it is far more faster than the other approaches posted here. I thought eval was evil :) The date looks like valid json. You can use

Re: [BangPypers] How should I do it?

2010-01-15 Thread Anand Balachandran Pillai
On Fri, Jan 15, 2010 at 4:13 PM, Anand Chitipothu anandol...@gmail.comwrote: On Fri, Jan 15, 2010 at 4:00 PM, Baishampayan Ghose b.gh...@gmail.com wrote: It is a clever hack, taking advantage of the nature of the data. But it is far more faster than the other approaches posted here. I

Re: [BangPypers] How should I do it?

2010-01-15 Thread Noufal Ibrahim
On Fri, Jan 15, 2010 at 4:13 PM, Anand Chitipothu anandol...@gmail.comwrote: On Fri, Jan 15, 2010 at 4:00 PM, Baishampayan Ghose b.gh...@gmail.com wrote: It is a clever hack, taking advantage of the nature of the data. But it is far more faster than the other approaches posted here. I

Re: [BangPypers] How should I do it?

2010-01-15 Thread Dhananjay Nene
On Fri, Jan 15, 2010 at 12:01 PM, Eknath Venkataramani eknath.i...@gmail.com wrote: 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

[BangPypers] How should I do it?

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: [BangPypers] How should I do it?

2010-01-14 Thread Dhananjay Nene
This seems to be an output of print_r of PHP. If you have a flexibility, try to have the PHP code output the data into a language neutral format (eg json, yaml, xml etc.) and then parse it in python using the appropriate parser. If not you may have to write a custom parser. I did google to find if