[Tutor] XML Programs

Glen glenuk at gmail.com
Thu Apr 19 10:32:19 EDT 2018


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 penny is not
dropping.

On 18 April 2018 at 08:39, Glen <glenuk at gmail.com> wrote:

> Hello Stefan,
>
> Thank you for this. That's actually quite helpful!
>
> Regards,
>
> On 17 April 2018 at 19:56, Stefan Behnel <stefan_ml at behnel.de> 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 code, how to store the xml
>> data
>> > in data structure etc,
>> >
>> > Can anyone recommend some source I can review that reads and writes data
>> > from an xml file.
>>
>> Here's a tutorial for the lxml package:
>>
>> http://lxml.de/tutorial.html
>>
>> However, I'd first check if there really is no Python library yet that
>> handles your "game files", whatever format they may have. One of the most
>> important things to learn about software engineering is to know when *not*
>> to write code to solve a problem.
>>
>> If you end up having (or wanting) to deal with the bare XML format
>> yourself, you may consider implementing your own XML API for your format,
>> so that you can nicely assign functionality to certain tags in the
>> document
>> tree. See the section on "Implementing Namespaces" here:
>>
>> http://lxml.de/element_classes.html
>>
>> Stefan
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> To unsubscribe or change subscription options:
>> https://mail.python.org/mailman/listinfo/tutor
>>
>
>


More information about the Tutor mailing list