Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Question about python library sumolib and .output.parse method

Hi,

Am 11.01.2018 um 17:19 schrieb Ahmed Abd Al-rahman:
> 1- How can I simultaneously parse the departure time and route edges
> from .rou.xml file?
> /for v in sumolib.output.parse(RouFilePath, "vehicle"):    /
> /     print (v.route.edges.split())/
> /     print v.depart/
> 
> but it returns error >> AttributeError: 'list' object has no attribute
> 'edges'

You need to refer to the route edges via v.route[0].edges since v.route
is a list because an XML element may contain multiple childs with the
same name (this is not true for the vehicle route case but the interface
is the same for all elements).

> 2- What is the difference between .output.parse and output.parse_fast?

parse_fast is faster but not as flexible. The two most obvious
limitations are that for parse_fast you need to know in which order the
attributes of an element appear in the XML file and you do not have
access to child elements just to the attributes.

Best regards,
Michael

Attachment: signature.asc
Description: OpenPGP digital signature


Back to the top