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


Groups > comp.lang.python > #97205

Re: Create a .lua fle from Python

From Laura Creighton <lac@openend.se>
Subject Re: Create a .lua fle from Python
References <CAMxmM6bhyHUpQXxnwO-OiesppP6mRM74=dA37VJwV212MZGyUw@mail.gmail.com>
Date 2015-09-29 13:42 +0200
Newsgroups comp.lang.python
Message-ID <mailman.235.1443526980.28679.python-list@python.org> (permalink)

Show all headers | View raw


In a message of Mon, 28 Sep 2015 18:41:09 -0300, Ariel ArgaƱaraz writes:
>Hi,
>This is my first post, I would like to know if a library that can help me
>with this.
>
>
>I want to parse a XML fle with Python and save the data into a Lua table
>called for example "newTable", then I want to create a "table.lua" fle with
>the "newTable" write on it.
>
>
>for example:
>
>the XML fle: cities.xml
>
><cities>
>     <city>
>              <name>BuenosAires</name>
>              <temperature>30</temperature>
>      </city>
><city>
>      <name>Seatle</name>
>      <temperature>25</temperature>
></city>
></cities>
>
>
>And  I want to create a cities_temp.lua file
>
>cities_temps ={
>["Buenos Aires"] = 30,
>["Seatle"] = 25,
>}
>
>
>Is that posible to do with LUPA (https://pypi.python.org/pypi/lupa)?? In
>the docs I read that you can create lua tables but I did not see if there
>is a way to create a .lua file with that table.
>
>
>I could do it with python writing to a file line per line but i want some
>more elegant.
>
>Can anyone give some help?
>
>Thanks.
>
>-- 
>Ariel ArgaƱaraz

Lupa is a partial re-write of lunatic python.
https://pypi.python.org/pypi/lunatic-python
with docs here:
http://labix.org/lunatic-python

and maybe that can do what you want.

But I don't know why you need to involve python at all.  Lua has
perfectly good xml parsers, indeed like python -- perhaps too many
of them.  Can't you just use lua?

Laura

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


Thread

Re: Create a .lua fle from Python Laura Creighton <lac@openend.se> - 2015-09-29 13:42 +0200

csiph-web