Re: [BangPypers] { Parsing excel file }

2014-03-10 Thread Mandar Vaze / मंदार वझे
> OPENPYXL :- Read and Write only XLSX file. (No support for XLS) > We are using openpyxl in our product - mainly because we needed to *create* xlsx files. -Mandar ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinf

Re: [BangPypers] { Parsing excel file }

2014-03-10 Thread karthik prakash
Hi, There are a couple of options, for excel connectivity in Python. XLRD :- Reading from XLS and XLSX files. XLWT :- Writing to XLS files (currently no support for XLSX) OPENPYXL :- Read and Write only XLSX file. (No support for XLS) Regards, Karthik   On Monday, 10 March 2014 5:21 PM, kona

Re: [BangPypers] { Parsing excel file }

2014-03-10 Thread konark modi
Hi For parsing .xls files with Python, I've used xlrd lib ( https://pypi.python.org/pypi/xlrd) quite extensively. Let's you move around multiple sheets aswell and parse data easily. Regards Konark On Mon, Mar 10, 2014 at 3:59 PM, Noufal Ibrahim KV wrote: > On Mon, Mar 10 2014, Shashidhar Parag

Re: [BangPypers] { Parsing excel file }

2014-03-10 Thread Noufal Ibrahim KV
On Mon, Mar 10 2014, Shashidhar Paragonda wrote: > Hello python hackers > > I have a excel file which is .xls format. My requirement is: the > excel file contains a manual test cases, in second column, I need to > read a file and extract thekeywords like : Login, logout, click to > optimize, enh

Re: [BangPypers] { Parsing }

2014-02-13 Thread Shashidhar Paragonda
We are using TestComplete tool to do automation testing. Automation testing script is generated using C#, Main concern is we are trying to generate C# automation test script using the manual test scripts. For manual test scripts we wanted to follow common script format i.e we thought of Gherkin fo

Re: [BangPypers] { Parsing }

2014-02-13 Thread Vaikuntham Jagannath
For what purpose are you trying to use C# Automation scripts? On Thu, Feb 13, 2014 at 6:29 PM, Shashidhar Paragonda < shashidha...@gmail.com> wrote: > Hi, lettuce solved the requirement of doing automation testing. > I have other requirement i.e I am using Python as scripting tool to perform > t

Re: [BangPypers] { Parsing }

2014-02-13 Thread Shashidhar Paragonda
Hi, lettuce solved the requirement of doing automation testing. I have other requirement i.e I am using Python as scripting tool to perform the automation script for C#. Is there any other library which best supports to perform the C# automation. --- Regards, Shas

Re: [BangPypers] { Parsing }

2014-02-11 Thread Vaikuntham Jagannath
You could consider using Lettuce [http://lettuce.it/] . It is a BDD framework in python. This could help you to build & maintain the automation scripts efficiently in the long run. Hope this helps.. Regards, jagan On Tue, Feb 11, 2014 at 5:17 PM, Shashidhar Paragonda < shashidha...@gmail.com> w

Re: [BangPypers] { Parsing }

2014-02-11 Thread Shashidhar Paragonda
Hi >>> The main requirement is to build autamation script parsing the Gherkin format. >>> We planned to use Gherkin format to basically convert the test use-cases. >>> Everyone who does manual / automation test, will use Gherkin format to generate the test use-cases, so that Gherkin becomes a commo

Re: [BangPypers] { Parsing }

2014-02-11 Thread Vaikuntham Jagannath
Hi, Why do you want to write a parser for the Gherkin format ? If we can know the underlying need, then may be We can suggest you more effectively. Regards, Jagan On Tue, Feb 11, 2014 at 2:26 PM, Shashidhar Paragonda < shashidha...@gmail.com> wrote: > Hello Python hackers > > >>> I wanted to wr

Re: [BangPypers] Parsing and updating XML files with python

2011-11-17 Thread Balachandran Sivakumar
Hi, On Thu, Nov 17, 2011 at 7:27 PM, Gora Mohanty wrote: > On Thu, Nov 17, 2011 at 4:47 PM, Balachandran Sivakumar > wrote: > > To update an element, just assign a value to it, e.g., >  myelem.text = "New value" > You can then save the modified XML to a new file. > Please see http://infohost.nmt

Re: [BangPypers] Parsing and updating XML files with python

2011-11-17 Thread Gora Mohanty
On Thu, Nov 17, 2011 at 4:47 PM, Balachandran Sivakumar wrote: > Hi, > >             I have to parse an xml file, get to a spefic node, and > set it to a different value and write it back to the file. What is the > best way to do it ? The xml file can be a few hundred lines(with > proper formattin

Re: [BangPypers] parsing xml

2011-09-30 Thread Dhananjay Nene
On Fri, Jul 29, 2011 at 10:47 AM, Anand Chitipothu wrote: > 2011/7/28 Venkatraman S : > > parsing using minidom is one of the slowest. if you just want to extract > the > > distance and assuming that it(the tag) will always be consistent, then i > > would always suggest regexp. xml parsing is a pa

Re: [BangPypers] Parsing data

2011-09-19 Thread Ananya Sharma
Thank you everybody for your input. It helped a lot in understanding the logic i had to implement in the program. I am familiar with the concept of regular expressions but in this case line breaks would have been an issue. At the end, I did some more reading and browsed through examples and got the

Re: [BangPypers] Parsing data

2011-09-18 Thread Gopalakrishnan Subramani
At least I am not great at regular expressions. I agree that regex may reduce the number of lines,. On Sun, Sep 18, 2011 at 12:55 PM, mahendra N wrote: > Fgt the link > > http://code.google.com/edu/languages/google-python-class/regular-expressions.html > > 2011/9/19 mahendra N > > > Have you t

Re: [BangPypers] Parsing data

2011-09-18 Thread mahendra N
Fgt the link http://code.google.com/edu/languages/google-python-class/regular-expressions.html 2011/9/19 mahendra N > Have you thought of using regular expressions?. It might make ur job > easier. > > Checkout this link good explaination of reg exps. > > Thanks and Regards, > Mahendra Naik > > >

Re: [BangPypers] Parsing data

2011-09-18 Thread mahendra N
Have you thought of using regular expressions?. It might make ur job easier. Checkout this link good explaination of reg exps. Thanks and Regards, Mahendra Naik 2011/9/18 Gopalakrishnan Subramani > Senthil and Gora Mohanty pointed out whats wrong on the code. > > This is alternative option, no

Re: [BangPypers] Parsing data

2011-09-18 Thread Gopalakrishnan Subramani
Senthil and Gora Mohanty pointed out whats wrong on the code. This is alternative option, not its best since I feel always good to parse the file B based on file spec instead of the following approach. file_a_lines = open('FileA.txt').readlines() file_b_content = open('FileB.txt').read() for l

Re: [BangPypers] Parsing data

2011-09-17 Thread Senthil Kumaran
On Fri, Sep 16, 2011 at 11:26:34PM -0500, Ananya Sharma wrote: > > *File A-* > >PSUB.GBD61H402FPT34:0-372 > > *File B-* > >PSUB.GBD61H402FPT34:0-372 > XX > XX >

Re: [BangPypers] Parsing data

2011-09-17 Thread Gora Mohanty
On Sun, Sep 18, 2011 at 2:19 AM, Ananya Sharma wrote: > The logic is that i have file A which has some names and file B which has > values for each name in file A and some extra values. I want to make a > script which gives me the values from file B corresponding to all the names > given in file A

Re: [BangPypers] Parsing data

2011-09-17 Thread Ananya Sharma
The logic is that i have file A which has some names and file B which has values for each name in file A and some extra values. I want to make a script which gives me the values from file B corresponding to all the names given in file A. My files look like - *File A-* >PSUB.GBD61H402FPT34:0-372 >P

Re: [BangPypers] Parsing data

2011-09-17 Thread Gora Mohanty
On Sat, Sep 17, 2011 at 9:33 PM, Ananya Sharma wrote: > I am trying to look up each value from file A and loop it through file B. As > i already said that I am new in python programming so this is what I could > come up with. Um, the code is quite far from accomplishing that. While I am sure that

Re: [BangPypers] Parsing data

2011-09-17 Thread Ananya Sharma
I am trying to look up each value from file A and loop it through file B. As i already said that I am new in python programming so this is what I could come up with. And this is the output of an algorithm I use in my research so its not a part of any homework assignment. On Sat, Sep 17, 2011 at 1:

Re: [BangPypers] Parsing data

2011-09-16 Thread Gora Mohanty
On Sat, Sep 17, 2011 at 9:56 AM, Ananya Sharma wrote: [...] Could you explain the logic that you are trying to use in the code below, because it is not making much sense. Also, is this a homework problem? > *Script-* > * > * > f1=open('fileA','r') > f2=open('fileB','r') > a="" > b="" > for n in

Re: [BangPypers] parsing xml

2011-08-01 Thread Dhananjay Nene
On Mon, Aug 1, 2011 at 7:51 PM, Noufal Ibrahim wrote: > Anand Balachandran Pillai writes: > >> On Mon, Aug 1, 2011 at 6:08 AM, Anand Chitipothu wrote: > > [...] > >> It is more subtler than that. >> >> List comprehensions are faster than map functions when >> the latter needs to invoke a user-def

Re: [BangPypers] parsing xml

2011-08-01 Thread Noufal Ibrahim
Anand Balachandran Pillai writes: > On Mon, Aug 1, 2011 at 6:08 AM, Anand Chitipothu wrote: [...] > It is more subtler than that. > > List comprehensions are faster than map functions when > the latter needs to invoke a user-defined function call or a lambda. > > Maps score over list comprehens

Re: [BangPypers] parsing xml

2011-08-01 Thread Dhananjay Nene
On Mon, Aug 1, 2011 at 12:46 AM, Noufal Ibrahim wrote: > Venkatraman S writes: > > >> Hang around in #django or #python. The most elegant code that you >> *should* write would invariably be pretty fast (am not ref to asm). > > I agree with you here. Pythonicity is best defined as what the > exper

Re: [BangPypers] parsing xml

2011-08-01 Thread Smrutilekha Swain
by using lxml...for example-: from lxml import etree content = etree.iterparse( *name of the xml file*, events=('start', 'end')) for event, elem in content: if elem.tag == 'distance': print elem.text Hope it will work.. On Mon, Aug 1, 2011 at 1:43 PM,

Re: [BangPypers] parsing xml

2011-08-01 Thread Anand Balachandran Pillai
On Mon, Aug 1, 2011 at 1:25 PM, Kiran Jonnalagadda wrote: > On 31-Jul-2011, at 11:33 PM, Venkatraman S wrote: > > > A regex is the simplest IMHO, because you need not know the syntax of the > > minidom parser. > > But, again i have seen this quiet often that lack of knowledge of regexp > has > >

Re: [BangPypers] parsing xml

2011-08-01 Thread Kiran Jonnalagadda
On 31-Jul-2011, at 11:33 PM, Venkatraman S wrote: > A regex is the simplest IMHO, because you need not know the syntax of the > minidom parser. > But, again i have seen this quiet often that lack of knowledge of regexp has > led people to other solutions (the grapes are sour!) In the eternal word

Re: [BangPypers] parsing xml

2011-08-01 Thread Dhananjay Nene
On Mon, Aug 1, 2011 at 12:43 AM, Noufal Ibrahim wrote: > Dhananjay Nene writes: > > > [...] > > > re.search("\s*(\d+)\s*",data).group(1) > > > > would appear to be the most succinct and quite fast. Adjust for > whitespace > > as and if necessary. > > Whitespace (including newlines), mixed cases

Re: [BangPypers] parsing xml

2011-07-31 Thread Kenneth Gonsalves
On Sun, 2011-07-31 at 19:57 +0530, Anand Balachandran Pillai wrote: > > xml parsing in the case when all that you need from the string is a > simple > > numeric value(not a string), then good luck; unlike esr i will not > use > > adjectives; but i would not use your code either. > > > > To be fair

Re: [BangPypers] parsing xml

2011-07-31 Thread Anand Balachandran Pillai
On Mon, Aug 1, 2011 at 6:08 AM, Anand Chitipothu wrote: > > Hang around in #django or #python. The most elegant code that you > *should* > > write would invariably be pretty fast (am not ref to asm). > > That doesn't mean that any code that is faster is elegant. > > IIRC, in python, map function r

Re: [BangPypers] parsing xml

2011-07-31 Thread Anand Chitipothu
> Hang around in #django or #python. The most elegant code that you *should* > write would invariably be pretty fast (am not ref to asm). That doesn't mean that any code that is faster is elegant. IIRC, in python, map function runs slightly faster than list comprehensions, but list comprehensions

Re: [BangPypers] parsing xml

2011-07-31 Thread Noufal Ibrahim
Venkatraman S writes: [...] > A regex is the simplest IMHO, because you need not know the syntax of the > minidom parser. Oh come on. This sounds like doing it the wrong way because you're not going to spend time reading the docs and then using performance as a cover for the laziness. [...]

Re: [BangPypers] parsing xml

2011-07-31 Thread Noufal Ibrahim
Dhananjay Nene writes: [...] > re.search("\s*(\d+)\s*",data).group(1) > > would appear to be the most succinct and quite fast. Adjust for whitespace > as and if necessary. Whitespace (including newlines), mixed cases etc. [...] > As far as optimisation goes - I can see at least 3 options >

Re: [BangPypers] parsing xml

2011-07-31 Thread Venkatraman S
On Sun, Jul 31, 2011 at 10:58 PM, Dhananjay Nene wrote: > a. the minidom performance is acceptable - no further optimisation required > b. minidom performance is not acceptable - try the regex one > c. python library performance is not acceptable - switch to 'c' > > I can imagine people starting w

Re: [BangPypers] parsing xml

2011-07-31 Thread Dhananjay Nene
On Thu, Jul 28, 2011 at 3:18 PM, Kenneth Gonsalves wrote: > hi, > > here is a simplified version of an xml file: > > > > > >CloudMade > >http://maps.cloudmade.com";> > > >h

Re: [BangPypers] parsing xml

2011-07-31 Thread Noufal Ibrahim
Anand Balachandran Pillai writes: > On Fri, Jul 29, 2011 at 4:41 PM, Venkatraman S wrote: [...] > To be fair here, I think what he is saying is that Kenneth's problem > (getting at the particular value) can be solved by using an aptly > written regular expression which might be the fastest - n

Re: [BangPypers] parsing xml

2011-07-31 Thread Anand Balachandran Pillai
On Fri, Jul 29, 2011 at 4:41 PM, Venkatraman S wrote: > Noufal, > > I have nothing more to say than this(as i see some tangential replies which > i am not interested in substantiating - for eg, i never suggested to use a > regexp based parser - a regexp based xml parser is different from using 'a

Re: [BangPypers] parsing xml

2011-07-29 Thread Noufal Ibrahim
Venkatraman S writes: [...] > Read my replies properly. Read my assumptions properly w.r.t the xml > structure and the requested value in the xml. Read the link that you > have pasted again. If possible, read the comments in the link > shared(from esr) again. Once done, think twice and tell me

Re: [BangPypers] parsing xml

2011-07-29 Thread Venkatraman S
Noufal, I have nothing more to say than this(as i see some tangential replies which i am not interested in substantiating - for eg, i never suggested to use a regexp based parser - a regexp based xml parser is different from using 'a' regexp on a string!) : Read my replies properly. Read my a

Re: [BangPypers] parsing xml

2011-07-29 Thread Sidu Ponnappa
> Along the same lines...the problems are more when xml is concerned, for even > if some other tag is malformed, then the > whole document is 'gone'. Well, then - the API is broken and is basically violating the TOS for the API (which I would at a minimum expect to return valid output or the approp

Re: [BangPypers] parsing xml

2011-07-29 Thread Gora Mohanty
On Fri, Jul 29, 2011 at 10:55 AM, Baishampayan Ghose wrote: >> minidom is the fastest solution if you consider the programmer time >> instead of developer time.  Minidom is available in standard library, >> you don't have to add another dependency and worry about PyPI >> downtimes and lxml compila

Re: [BangPypers] parsing xml

2011-07-29 Thread Baishampayan Ghose
On Fri, Jul 29, 2011 at 1:09 PM, Venkatraman S wrote: > IMHO, regexps are much more powerful and fault tolerant than XML parsing. > XMLs are brittle. Did you mean parsing XML using Regular Expressions is "more powerful and fault tolerant" than using a XML parser? Regards, BG -- Baishampayan Gh

Re: [BangPypers] parsing xml

2011-07-29 Thread Noufal Ibrahim
Venkatraman S writes: > n Fri, Jul 29, 2011 at 12:20 PM, Noufal Ibrahim wrote: > >> I agree and I try my best to do the same thing. However, I differentiate >> between micro optimsations like rewriting parts in C and XML and top >> level optimisations like good design and the right data structur

Re: [BangPypers] parsing xml

2011-07-29 Thread Venkatraman S
n Fri, Jul 29, 2011 at 12:20 PM, Noufal Ibrahim wrote: > I agree and I try my best to do the same thing. However, I differentiate > between micro optimsations like rewriting parts in C and XML and top > level optimisations like good design and the right data structures. > > Using regexp is micro

Re: [BangPypers] parsing xml

2011-07-29 Thread Umar Shah
+1 On Fri, Jul 29, 2011 at 12:50 PM, Sidu Ponnappa wrote: > +1. > > On Fri, Jul 29, 2011 at 12:20 PM, Noufal Ibrahim wrote: > > Venkatraman S writes: > > > >> On Fri, Jul 29, 2011 at 11:31 AM, Noufal Ibrahim > wrote: > >> > >>> > I am a speed-maniac and crave for speed; so if the assumption is

Re: [BangPypers] parsing xml

2011-07-29 Thread Sidu Ponnappa
+1. On Fri, Jul 29, 2011 at 12:20 PM, Noufal Ibrahim wrote: > Venkatraman S writes: > >> On Fri, Jul 29, 2011 at 11:31 AM, Noufal Ibrahim wrote: >> >>> > I am a speed-maniac and crave for speed; so if the assumption is >>> > valid, i can vouch for the fact that regexp would be faster and neater

Re: [BangPypers] parsing xml

2011-07-28 Thread Noufal Ibrahim
Venkatraman S writes: > On Fri, Jul 29, 2011 at 11:31 AM, Noufal Ibrahim wrote: > >> > I am a speed-maniac and crave for speed; so if the assumption is >> > valid, i can vouch for the fact that regexp would be faster and neater >> > solution. I have done some speed experiments in past on this (r

Re: [BangPypers] parsing xml

2011-07-28 Thread Venkatraman S
On Fri, Jul 29, 2011 at 11:31 AM, Noufal Ibrahim wrote: > > I am a speed-maniac and crave for speed; so if the assumption is > > valid, i can vouch for the fact that regexp would be faster and neater > > solution. I have done some speed experiments in past on this (results > > of which i do not h

Re: [BangPypers] parsing xml

2011-07-28 Thread Venkatraman S
On Fri, Jul 29, 2011 at 11:44 AM, Noufal Ibrahim wrote: > > And I'm telling you that even a slight change to the tag - an extra > space, a newline, a new attribute, a change in case or any such thing > which doesn't modify it's meaning as far as the XML snippet is concerned > will break your rege

Re: [BangPypers] parsing xml

2011-07-28 Thread Noufal Ibrahim
Venkatraman S writes: [...] > Sigh! Again, guys, i am referring to regexp when all you need is some > number within a tag! If the content of that tag was text, i would > have never suggested this solution. [...] And I'm telling you that even a slight change to the tag - an extra space, a newli

Re: [BangPypers] parsing xml

2011-07-28 Thread Venkatraman S
On Fri, Jul 29, 2011 at 11:31 AM, Noufal Ibrahim wrote: > > > Well, i have clearly mentioned my assumptions - i.e, when you treat > > the XML as a 'string' and do not want to retrieve anything else in a > > 'structured manner'. > > > If the data is structured, it makes sense to exploit that struc

Re: [BangPypers] parsing xml

2011-07-28 Thread Venkatraman S
On Fri, Jul 29, 2011 at 11:15 AM, Anand Chitipothu wrote: > 2011/7/29 Venkatraman S : > > On Fri, Jul 29, 2011 at 10:47 AM, Anand Chitipothu >wrote: > > > >> 2011/7/28 Venkatraman S : > >> > parsing using minidom is one of the slowest. if you just want to > extract > >> the > >> > distance and as

Re: [BangPypers] parsing xml

2011-07-28 Thread Noufal Ibrahim
Venkatraman S writes: [...] > Well, i have clearly mentioned my assumptions - i.e, when you treat > the XML as a 'string' and do not want to retrieve anything else in a > 'structured manner'. If the data is structured, it makes sense to exploit that structure and use a proper solution. > I a

Re: [BangPypers] parsing xml

2011-07-28 Thread Anand Chitipothu
2011/7/29 Baishampayan Ghose : >> minidom is the fastest solution if you consider the programmer time >> instead of developer time.  Minidom is available in standard library, >> you don't have to add another dependency and worry about PyPI >> downtimes and lxml compilations failures. > > FWIW, Elem

Re: [BangPypers] parsing xml

2011-07-28 Thread Anand Chitipothu
2011/7/29 Venkatraman S : > On Fri, Jul 29, 2011 at 10:47 AM, Anand Chitipothu > wrote: > >> 2011/7/28 Venkatraman S : >> > parsing using minidom is one of the slowest. if you just want to extract >> the >> > distance and assuming that it(the tag) will always be consistent, then i >> > would alway

Re: [BangPypers] parsing xml

2011-07-28 Thread Venkatraman S
On Fri, Jul 29, 2011 at 10:47 AM, Anand Chitipothu wrote: > 2011/7/28 Venkatraman S : > > parsing using minidom is one of the slowest. if you just want to extract > the > > distance and assuming that it(the tag) will always be consistent, then i > > would always suggest regexp. xml parsing is a pa

Re: [BangPypers] parsing xml

2011-07-28 Thread Baishampayan Ghose
> minidom is the fastest solution if you consider the programmer time > instead of developer time.  Minidom is available in standard library, > you don't have to add another dependency and worry about PyPI > downtimes and lxml compilations failures. FWIW, ElementTree is a part of the standard libr

Re: [BangPypers] parsing xml

2011-07-28 Thread Anand Chitipothu
2011/7/28 Venkatraman S : > parsing using minidom is one of the slowest. if you just want to extract the > distance and assuming that it(the tag) will always be consistent, then i > would always suggest regexp. xml parsing is a pain. regexp is a bad solution to parse xml. minidom is the fastest s

Re: [BangPypers] parsing xml

2011-07-28 Thread Joseph Gladson
Hi, check and try pyparsing module... U could do it so simple:) regards, joseph On 7/29/11, Ramdas S wrote: > On Fri, Jul 29, 2011 at 1:23 AM, Gora Mohanty wrote: > >> On Thu, Jul 28, 2011 at 10:37 PM, Venkatraman S >> wrote: >> > parsing using minidom is one of the slowest. if you just w

Re: [BangPypers] parsing xml

2011-07-28 Thread Ramdas S
On Fri, Jul 29, 2011 at 1:23 AM, Gora Mohanty wrote: > On Thu, Jul 28, 2011 at 10:37 PM, Venkatraman S > wrote: > > parsing using minidom is one of the slowest. if you just want to extract > the > > distance and assuming that it(the tag) will always be consistent, then i > > would always suggest

Re: [BangPypers] parsing xml

2011-07-28 Thread Gora Mohanty
On Thu, Jul 28, 2011 at 10:37 PM, Venkatraman S wrote: > parsing using minidom is one of the slowest. if you just want to extract the > distance and assuming that it(the tag) will always be consistent, then i > would always suggest regexp. xml parsing is a pain. [...] Strongly disagree. IMHO, reg

Re: [BangPypers] parsing xml

2011-07-28 Thread Venkatraman S
parsing using minidom is one of the slowest. if you just want to extract the distance and assuming that it(the tag) will always be consistent, then i would always suggest regexp. xml parsing is a pain. ___ BangPypers mailing list BangPypers@python.org htt

Re: [BangPypers] parsing xml

2011-07-28 Thread Sidu Ponnappa
If you're doing this repeatedly, you may want to just delegate to a native XPath implementation. I haven't done much Python, so I can't comment on your choices, but in Ruby I'd simply hand off to libXML using Nokogiri. This approach should be a whole lot faster, but I'd advise benchmarking first be

Re: [BangPypers] parsing xml

2011-07-28 Thread kracekumar ramaraju
You can try beautifulsoup, recommended for python/XML Parsing. ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

Re: [BangPypers] parsing xml

2011-07-28 Thread Kenneth Gonsalves
On Thu, 2011-07-28 at 15:33 +0530, Anand Chitipothu wrote: > > I want to get the value of the distance element - 1489. What is the > > simplest way of doing this? > > >>> from xml.dom import minidom > >>> dom = minidom.parseString(x) > >>> dom.getElementsByTagName("distance")[0].childNodes[0].node

Re: [BangPypers] parsing xml

2011-07-28 Thread Baishampayan Ghose
> here is a simplified version of an xml file: > > >     >         >                 >                CloudMade >                 >                http://maps.cloudmade.com";> >                 >                 >                http://cloudmade.com/faq#license >                 >                2

Re: [BangPypers] parsing xml

2011-07-28 Thread Anand Chitipothu
2011/7/28 Kenneth Gonsalves : > hi, > > here is a simplified version of an xml file: > > >     >         >                 >                CloudMade >                 >                http://maps.cloudmade.com";> >                 >                 >                http://cloudmade.com/faq#licens

Re: [BangPypers] parsing xml

2011-07-28 Thread Ramdas S
On Thu, Jul 28, 2011 at 3:20 PM, Venkatraman S wrote: > grep or regexp? > > -V > ___ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > can write an Xml parsing query -- Ramdas S +91 9342 583 065

Re: [BangPypers] parsing xml

2011-07-28 Thread hemant
Using xpath such as: /gpx/extensions/distance(:text) ? On Thu, Jul 28, 2011 at 3:20 PM, Venkatraman S wrote: > grep or regexp? > > -V > ___ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > -

Re: [BangPypers] parsing xml

2011-07-28 Thread Venkatraman S
grep or regexp? -V ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

Re: [BangPypers] parsing directory and subdirecties

2010-11-19 Thread Dhananjay Nene
On Sat, Nov 20, 2010 at 5:28 AM, Vasudevan N wrote: > The simplest way would be to use recursive calls. > Vasu, a. That could still entail a loop on a files per directory basis b. If you avoid the loop and recurse on a per file (eg by shaving the head off the sequence and passing on the tail), t

Re: [BangPypers] parsing directory and subdirecties

2010-11-19 Thread Vasudevan N
The simplest way would be to use recursive calls. Thanks, Vasu On Wed, Nov 17, 2010 at 8:05 PM, Nitin Kumar wrote: > hi all, > > is there any simple way where a can parse into directory and subdirectories > to get the detail of files and count. > > or do i need to use looping and other function

Re: [BangPypers] parsing directory and subdirecties

2010-11-18 Thread Dhananjay Nene
On Thu, Nov 18, 2010 at 10:46 AM, Kenneth Gonsalves wrote: > On Thu, 2010-11-18 at 10:26 +0530, Asokan Pichai wrote: > > On 18 November 2010 09:35, Nitin Kumar wrote: > > > hi all, > > > > > > is there any simple way where a can parse into directory and > > subdirectories > > > to get the detail

Re: [BangPypers] parsing directory and subdirecties

2010-11-18 Thread Senthil Kumaran
On Thu, Nov 18, 2010 at 10:46:47AM +0530, Kenneth Gonsalves wrote: > > > > Check if os.walk() is useful. > > but that is looping - which he does not want. Then he can wrap python over 'find -type f |wc -l' - Provided he is on POSIX and wants to just count the files. os.system('find -type f |wc

Re: [BangPypers] parsing directory and subdirecties

2010-11-17 Thread Kenneth Gonsalves
On Thu, 2010-11-18 at 10:26 +0530, Asokan Pichai wrote: > On 18 November 2010 09:35, Nitin Kumar wrote: > > hi all, > > > > is there any simple way where a can parse into directory and > subdirectories > > to get the detail of files and count. > > Check if os.walk() is useful. but that is loopi

Re: [BangPypers] parsing directory and subdirecties

2010-11-17 Thread Asokan Pichai
On 18 November 2010 09:35, Nitin Kumar wrote: > hi all, > > is there any simple way where a can parse into directory and subdirectories > to get the detail of files and count. Check if os.walk() is useful. -- Asokan Pichai *---* We will find a way. Or, make one. (Hannibal) __