Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79238

Re: Help in using grako for parsing

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'output': 0.05; 'variables': 0.07; 'explanation': 0.09; 'forcing': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:parsing': 0.09; 'subject:using': 0.09; 'subject:Help': 0.11; 'did.': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'throw': 0.16; 'varies': 0.16; 'whatsoever': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'trying': 0.19; 'split': 0.19; 'input': 0.22; 'programming': 0.22; 'header :User-Agent:1': 0.23; 'parse': 0.24; 'script.': 0.24; 'post': 0.26; 'values': 0.27; 'header:X-Complaints-To:1': 0.27; 'tried': 0.27; 'idea': 0.28; 'function': 0.29; 'extract': 0.31; 'file': 0.32; 'there.': 0.32; 'could': 0.34; 'but': 0.35; 'accessible': 0.36; 'doing': 0.36; "didn't": 0.36; 'feedback': 0.38; 'represent': 0.38; 'to:addr:python-list': 0.38; 'previous': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'even': 0.60; 'read': 0.60; 'numbers': 0.61; "you're": 0.61; "you'll": 0.62; 'email addr:gmail.com': 0.63; 'provide': 0.64; 'more': 0.64; 'sample': 0.67; 'below.': 0.71; 'physical': 0.72; 'beside': 0.84; 'id,': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: Help in using grako for parsing
Date Fri, 17 Oct 2014 10:57:38 +0200
Organization None
References <7228e528-c597-4fd3-8620-508361aa0f6b@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p57bd845a.dip0.t-ipconnect.de
User-Agent KNode/4.13.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.14942.1413536278.18130.python-list@python.org> (permalink)
Lines 59
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1413536278 news.xs4all.nl 2955 [2001:888:2000:d::a6]:49948
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:79238

Show key headers only | View raw


varun7rs@gmail.com wrote:

> Hello,
> I am trying to parse a file which ahs the below content. I tried using the
> split function but that wasn't a good programming practice. I had to use
> it repeatedly to split the line and then read my data. I thought of doing
> it in a better way which is when I came across grako. But I have no idea
> whatsoever about the usage of grako in a script. It would be nice if any
> of you could help me understand the usage of grako. I need to extract the
> values beside the variables z, f and x. The numbers represent the request
> ID, virtualNode ID and physical nodeID for x and it varies a bit for f,

We know Python, but not necessarily any terminology you throw at us.

I didn't respond to your previous post because I had no idea what a .sol 
file is and what you're up to. As far as I can see no-one did. Now you make 
it even harder to help you by forcing us to look up "grako" to not (sic!) 
understand your question...

You give sample input below. Perhaps you'll get more/better feedback if you 
provide a sample of the output you need, too, together with a more elaborate 
and accessible explanation of how you think you could get there.

> z_0                  1.000000
> x_0_0_1              1.000000
> x_0_1_5              1.000000
> x_0_2_20             1.000000
> x_0_3_21             1.000000
> x_0_4_8              1.000000
> f_0_0(0,1)_(1,5)     1.000000
> f_0_1(1,2)_(5,9)     1.000000
> f_0_1(1,2)_(9,20)    1.000000
> f_0_2(2,3)_(2,21)    1.000000
> f_0_2(3,2)_(2,22)    1.000000
> f_0_2(2,3)_(20,22)   1.000000
> f_0_3(4,3)_(8,10)    1.000000
> f_0_3(3,4)_(0,10)    1.000000
> f_0_3(4,3)_(0,14)    1.000000
> f_0_3(4,3)_(14,21)   1.000000
> z_1                  1.000000
> x_1_0_16             1.000000
> x_1_1_6              1.000000
> x_1_2_13             1.000000
> x_1_3_0              1.000000
> x_1_4_25             1.000000
> x_1_5_15             1.000000
> x_1_6_19             1.000000
> f_1_0(1,0)_(6,16)    1.000000
> f_1_1(0,2)_(6,11)    1.000000
> f_1_1(0,2)_(11,13)   1.000000
> f_1_1(2,0)_(6,16)    1.000000
> f_1_2(3,1)_(0,6)     1.000000
> f_1_3(2,4)_(13,25)   1.000000
> f_1_4(5,4)_(15,25)   1.000000
> f_1_5(3,6)_(0,1)     1.000000
> f_1_5(3,6)_(1,18)    1.000000
> f_1_5(3,6)_(18,19)   1.000000

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Help in using grako for parsing varun7rs@gmail.com - 2014-10-17 01:33 -0700
  Re: Help in using grako for parsing Peter Otten <__peter__@web.de> - 2014-10-17 10:57 +0200
  Re: Help in using grako for parsing varun7rs@gmail.com - 2014-10-17 02:17 -0700
  Re: Help in using grako for parsing varun7rs@gmail.com - 2014-10-17 02:18 -0700

csiph-web