On Apr 21, 2018 09:06, Peter Otten <__pete...@web.de> wrote:
>
> Glen wrote:
>
> > Thank you for your comprehensive reply. It was very helpful!
> > Just to clarify one point, is it not possible to search for a node
> > directly in the element / elementTree or do you first need to pull the
> > data
Glen wrote:
> Thank you for your comprehensive reply. It was very helpful!
> Just to clarify one point, is it not possible to search for a node
> directly in the element / elementTree or do you first need to pull the
> data into a class/dict?
You certainly have other options
>>> catalog.xpath("/
Glen wrote:
> Hey guys,
>
> I have the following code:
>
> https://repl.it/@glendog/HurtfulPunctualInterface
from lxml import etree
catalog = etree.parse("example.xml")
def getbooks(xmldata):
books = xmldata.xpath("//catalog")[0]
for item in books:
print(item.findtext("title")
Hey guys,
I have the following code:
https://repl.it/@glendog/HurtfulPunctualInterface
Using the function I have define I can print to screen a list of books.
However, how can I search for records within the xml using an ID or the
title of the book etc? I've tried reading the tutorial but the pe
Hello Stefan,
Thank you for this. That's actually quite helpful!
Regards,
On 17 April 2018 at 19:56, Stefan Behnel wrote:
> Glen schrieb am 16.04.2018 um 13:10:
> > I'm writing a save-game editor for a game I play (just a project to
> learn).
> > But I am struggling on how to structure the cod
Glen schrieb am 16.04.2018 um 13:10:
> I'm writing a save-game editor for a game I play (just a project to learn).
> But I am struggling on how to structure the code, how to store the xml data
> in data structure etc,
>
> Can anyone recommend some source I can review that reads and writes data
> f
leam hall schrieb am 16.04.2018 um 14:54:
> On Mon, Apr 16, 2018 at 7:10 AM, Glen wrote:
>> I'm writing a save-game editor for a game I play (just a project to learn).
>> But I am struggling on how to structure the code, how to store the xml data
>> in data structure etc,
>>
>> Can anyone recommend
Hi,
Maybe you should give a try to xmltodict package
George
leam hall ezt írta (időpont: 2018. ápr. 16., H 15:14):
> Yeah, understood.
>
> Okay, knowing that others are smarter about python, and ElementTree,
> here's some code I was using to parse XML. Took a while to recover
> from. :)
>
> L
Yeah, understood.
Okay, knowing that others are smarter about python, and ElementTree,
here's some code I was using to parse XML. Took a while to recover
from. :)
Leam
#
import xml.etree.ElementTree as ET
import os
import argparse
import fnmatch
def show_info(file, element):
action
I understand, I'd love to use something else but the save game files are in
XML so I have no choice :'(
On 16 April 2018 at 13:54, leam hall wrote:
> On Mon, Apr 16, 2018 at 7:10 AM, Glen wrote:
> > Hey guys,
> >
> > I'm writing a save-game editor for a game I play (just a project to
> learn).
On Mon, Apr 16, 2018 at 7:10 AM, Glen wrote:
> Hey guys,
>
> I'm writing a save-game editor for a game I play (just a project to learn).
> But I am struggling on how to structure the code, how to store the xml data
> in data structure etc,
>
> Can anyone recommend some source I can review that rea
11 matches
Mail list logo