[BangPypers] Question on Pattern Matching and Regular Expression

2013-01-07 Thread davidsnt
Bangpypers, Having a little trouble in parsing a file of 702 line appox, the file is in the format # # # [Space] [ Few lines of information about the title ] [Space] # # # [Space] [ Few lines of information about the title ] I want to read this file block by block, the need is build a d

Re: [BangPypers] Question on Pattern Matching and Regular Expression

2013-01-07 Thread Gora Mohanty
On 7 January 2013 15:06, davidsnt wrote: > Bangpypers, > > Having a little trouble in parsing a file of 702 line appox, > > the file is in the format > > # > # > # > [Space] > [ > > Few lines of information about the title > > ] > > [Space] If the above format is strictly followed, this should d

Re: [BangPypers] Question on Pattern Matching and Regular Expression

2013-01-07 Thread davidsnt
I am trying with re.split to split the file based on the pattern but stuck at the point where I am unable to move forward, I also need this app to be able to do a search in the file based on the title. Regards, Davidsanthosh L On Mon, Jan 7, 2013 at 3:21 PM, steve wrote: > On Monday 07 January

Re: [BangPypers] Question on Pattern Matching and Regular Expression

2013-01-07 Thread Gora Mohanty
On 7 January 2013 15:38, Gora Mohanty wrote: > import re > TITLE_RE = re.compile( r'#\n#([^\n]*)\n#\n \n\[([^\]]*)\]\n \n', > re.MULTILINE|re.DOTALL ) > for m in TITLE_RE.finditer( s.strip ): > title, info = m.groups() > print title, info Oops, that should be s.strip(), viz., import re

Re: [BangPypers] Question on Pattern Matching and Regular Expression

2013-01-07 Thread davidsnt
Gora, Can you help me with few links that you have handy to which I can refer to build a parser instead of RE Regards, Davidsanthosh L On Mon, Jan 7, 2013 at 3:38 PM, Gora Mohanty wrote: > On 7 January 2013 15:06, davidsnt wrote: > > Bangpypers, > > > > Having a little trouble in parsing a f

Re: [BangPypers] Question on Pattern Matching and Regular Expression

2013-01-07 Thread steve
On Monday 07 January 2013 03:06 PM, davidsnt wrote: Bangpypers, Having a little trouble in parsing a file of 702 line appox, the file is in the format [...snip...] Could you show us what you already have done ? cheers, - steve ___ BangPypers maili

Re: [BangPypers] Question on Pattern Matching and Regular Expression

2013-01-07 Thread Amit Sethi
On Mon, Jan 7, 2013 at 3:52 PM, davidsnt wrote: > Gora, > > Can you help me with few links that you have handy to which I can refer to > build a parser instead of RE Can you elaborate on the idea of "build a parser" , in any case you will have to use regex. > I also need this app to be >able to

Re: [BangPypers] Question on Pattern Matching and Regular Expression

2013-01-07 Thread davidsnt
No this file changes very often, like once in 5 minutes and the values are updated, also there is no way I can move it to a database. Regards, Davidsanthosh L On Mon, Jan 7, 2013 at 4:55 PM, Amit Sethi wrote: > On Mon, Jan 7, 2013 at 3:52 PM, davidsnt wrote: > > Gora, > > > > Can you help me w

Re: [BangPypers] Question on Pattern Matching and Regular Expression

2013-01-07 Thread Syed Mushtaq
What do you really want to do * * http://mywiki.wooledge.org/XyProblem On Mon, Jan 7, 2013 at 5:02 PM, davidsnt wrote: > No this file changes very often, like once in 5 minutes and the values are > updated, also there is no way I can move it to a database. > > Regards, > Davidsanthosh L > > >

[BangPypers] [OT] Introducing myself

2013-01-07 Thread Jonathan Toomim
Hello all, My name is Jonathan Toomim. I'm a neuroscientist, electrical engineer, programmer (with a strong preference for python), and entrepreneur. I'll be moving from San Francisco to Bangalore on February 11th/12th. I have never been to India before, so I will probably be rather bewildered

Re: [BangPypers] [OT] Introducing myself

2013-01-07 Thread kracekumar ramaraju
There is an unofficial hackerspace in bangalore, it is Centre for Internet Society. http://cis-india.org/. You should visit. On Mon, Jan 7, 2013 at 10:13 PM, Jonathan Toomim wrote: > Hello all, > > My name is Jonathan Toomim. I'm a neuroscientist, electrical engineer, > programmer (with a strong

Re: [BangPypers] [OT] Introducing myself

2013-01-07 Thread स्वक्ष
On Mon, Jan 7, 2013 at 10:13 PM, Jonathan Toomim wrote: > Hello all, > > My name is Jonathan Toomim. I'm a neuroscientist, electrical engineer, > programmer (with a strong preference for python), and entrepreneur. I'll be > moving from San Francisco to Bangalore on February 11th/12th. I have never

Re: [BangPypers] Question on Pattern Matching and Regular Expression

2013-01-07 Thread Rahul R
Hey David, Assuming , its not a continuous stream of data being written to file all the time. you could do something like this https://gist.github.com/4477268 . you can enhance it and make it more pythonic. :) Thanks, Rahul On Mon, Jan 7, 2013 at 5:02 PM, davidsnt wrote: > No this file ch

Re: [BangPypers] Question on Pattern Matching and Regular Expression

2013-01-07 Thread Dhruv Baldawa
regex = """# #(?P[a-zA-Z]+) # Population = (?P\d+)cr Temperature = (?P\d+) deg cel Area = (?P\d+) sqft""" regex = re.compile(regex, flags=re.MULTILINE) print regex.findall(rstr) # >>> [('Delhi', '7', '10', '13000'), ('Mumbai', '10', '30', '132000')] for x in regex.finditer(rstr): group = x.g

Re: [BangPypers] Question on Pattern Matching and Regular Expression

2013-01-07 Thread Dhruv Baldawa
Sorry, I just hit the TAB key, and the message got delivered. I am not sure if this is what you want. If it is then to accomplish this, you will need to read the entire file first, and then compile the regex. Iterate using finditer(), and take the groupdict() to get all the values. Also, I have typ

Re: [BangPypers] [OT] Introducing myself

2013-01-07 Thread Pradeep Banavara
Hi Jonathan - CIS might be more suited for your needs. Jaaga is in a good location but it's a bit noisy and there's no quiet space. Other options: IIM, Bangalore runs an accelerator. It might not hurt to contact them and see if you can get some space. IISc runs an incubation center with good spa

Re: [BangPypers] [OT] Introducing myself [Jonathan Toomin]

2013-01-07 Thread Aditya Athalye
Sorry folks, forgot to change the subject line to my reply. I stand corrected. And the text of my reply is included again, below. -Aditya. > -Original Message- > From: Aditya Athalye [mailto:aditya.atha...@gmail.com] > Sent: 08 January 2013 08:46 > To: 'jtoo...@jtoomim.org' > Cc: 'bangpyp

Re: [BangPypers] BangPypers Digest, Vol 65, Issue 5

2013-01-07 Thread Aditya Athalye
Hello Jonathan, Like @krace says, it will be good to explore CIS. I can vouch for Jaaga. I've used the co-working space there and I think it's a real nice spot to work out of. Several tech start-ups / tech freelancers use the space, along with creative folk. I believe a few python programmers also

Re: [BangPypers] [OT] Introducing myself

2013-01-07 Thread Gopalakrishnan Subramani
I agree with Jaaga comments. Jaaga is little noisy due to near by busy road, I would prefer that place if you don't get another place. You also find co-working spaces in many places as Bangalore runs a lot of startups and early stage companies ready to share per seat basis. I love the Jaaga idea an

Re: [BangPypers] [OT] Introducing myself

2013-01-07 Thread Kiran Jonnalagadda
On Monday, 7 January 2013 at 11:20 PM, स्वक्ष wrote: > On Mon, Jan 7, 2013 at 10:13 PM, Jonathan Toomim (mailto:jtoo...@jtoomim.org)> wrote: > > In particular, I'll be looking for a place to do work. In California, I > > spend a lot of time at hackerspaces, especially Noisebridge > >

Re: [BangPypers] [OT] Introducing myself

2013-01-07 Thread स्वक्ष
On Tue, Jan 8, 2013 at 5:40 AM, Kiran Jonnalagadda wrote: > On Monday, 7 January 2013 at 11:20 PM, स्वक्ष wrote: >> On Mon, Jan 7, 2013 at 10:13 PM, Jonathan Toomim > (mailto:jtoo...@jtoomim.org)> wrote: >> > In particular, I'll be looking for a place to do work. In California, I >> > spend a lot