Create a .lua fle from Python

Ariel Argañaraz arielin82 at gmail.com
Mon Sep 28 17:41:09 EDT 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150928/73dd2c87/attachment.html>


More information about the Python-list mailing list