Path: csiph.com!news.swapon.de!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; 'subject:Python': 0.05; 'table.': 0.07; 'cc:addr:python-list': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'example:': 0.10; 'python': 0.10; 'python.': 0.11; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'help?': 0.16; 'message-id:@fido.openend.se': 0.16; 're- write': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'laura': 0.18; 'library': 0.20; '2015': 0.20; 'cc:addr:python.org': 0.20; 'cc:2**1': 0.22; 'parse': 0.22; 'sep': 0.22; 'subject: .': 0.22; 'tables': 0.23; 'xml': 0.24; 'all.': 0.24; 'mon,': 0.24; 'example': 0.26; 'this.': 0.28; 'received:se': 0.29; 'cc:no real name:2**1': 0.29; 'anyone': 0.32; "can't": 0.32; 'table': 0.32; 'maybe': 0.33; 'url:python': 0.33; 'file': 0.34; 'could': 0.35; 'skip:> 10': 0.35; 'but': 0.36; 'too': 0.36; 'there': 0.36; 'url:org': 0.36; 'subject:: ': 0.37; 'why': 0.39; 'data': 0.39; 'subject:from': 0.39; 'some': 0.40; 'save': 0.60; 'header:Message-Id:1': 0.61; 'per': 0.62; '30,': 0.63; 'here:': 0.63; '>with': 0.84; 'header:In-reply-to:1': 0.84; 'posible': 0.84; 'post,': 0.84 To: =?UTF-8?Q?Ariel_Arga=C3=B1araz?= cc: python-list@python.org, lac@openend.se From: Laura Creighton Subject: Re: Create a .lua fle from Python In-reply-to: References: Comments: In-reply-to =?UTF-8?Q?Ariel_Arga=C3=B1araz?= message dated "Mon, 28 Sep 2015 18:41:09 -0300." MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <11064.1443526970.1@fido> Content-Transfer-Encoding: 8bit Date: Tue, 29 Sep 2015 13:42:50 +0200 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [82.96.5.2]); Tue, 29 Sep 2015 13:42:52 +0200 (CEST) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 62 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1443526980 news.xs4all.nl 23837 [2001:888:2000:d::a6]:51303 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:97205 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 > > > > BuenosAires > 30 > > > Seatle > 25 > > > > >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