Re: Perl XML::Simple and Data::Dumper - exists in Python?
Miguel Manso wrote: Hi there, I'm a Perl programmer trying to get into Python. I've been reading some documentation and I've choosed Python has being the next step to give. Can you point me out to Python solutions for: 1) Perl's Data::Dumper It dumps any perl variable to the stdout in a readable way. All Python objects support reflection and can be serialized to a data stream. There's about four ways to do it (Kinda perl-like in that regard, but typically for a particular application there's one obvious right choice). You control the way your objects appear as strings, by defining a __str__ member function that'll be invoked if the user does: % print str(yourObject) You can print any builtin type with just: lst = [one, two, (3, 4.56), 1] print lst ['one', 'two', (3, 4.5596), 1] 2) Perl's XML::Simple It maps a XML file into a Perl data structure. Python's got a Document Object Model lib that essentially maps an XML file to objects that have built-in-type behavior - you can treat a NodeList object as a python list, indexing into it, iterating over it's contents, etc. It's also got SAX and expat bindings. Does Python have something like these two tools? I've been googling before posting this and didn't find anything. Do your searches at python.org. // Wally -- http://mail.python.org/mailman/listinfo/python-list
Perl XML::Simple and Data::Dumper - exists in Python?
Hi there, I'm a Perl programmer trying to get into Python. I've been reading some documentation and I've choosed Python has being the next step to give. Can you point me out to Python solutions for: 1) Perl's Data::Dumper It dumps any perl variable to the stdout in a readable way. 2) Perl's XML::Simple It maps a XML file into a Perl data structure. Does Python have something like these two tools? I've been googling before posting this and didn't find anything. Thanks for the help. -- Miguel Manso [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Perl XML::Simple and Data::Dumper - exists in Python?
Miguel Manso wrote: Can you point me out to Python solutions for: 1) Perl's Data::Dumper It dumps any perl variable to the stdout in a readable way. import pprint help(pprint) 2) Perl's XML::Simple It maps a XML file into a Perl data structure. some alternatives: http://www.effbot.org/tags/elementtree http://article.gmane.org/gmane.comp.python.tutor/24986 http://www.crummy.com/software/BeautifulSoup/ http://www.aaronsw.com/2002/xmltramp/ http://www.xml.com/pub/a/2005/01/19/amara.html /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Perl XML::Simple and Data::Dumper - exists in Python?
Fredrik Lundh [EMAIL PROTECTED] wrote: Miguel Manso wrote: Can you point me out to Python solutions for: 1) Perl's Data::Dumper It dumps any perl variable to the stdout in a readable way. import pprint help(pprint) 2) Perl's XML::Simple It maps a XML file into a Perl data structure. some alternatives: http://www.effbot.org/tags/elementtree http://article.gmane.org/gmane.comp.python.tutor/24986 http://www.crummy.com/software/BeautifulSoup/ http://www.aaronsw.com/2002/xmltramp/ http://www.xml.com/pub/a/2005/01/19/amara.html One more: http://www.xml.com/pub/a/2003/07/02/py-xml.html George -- http://mail.python.org/mailman/listinfo/python-list