472,362 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,362 software developers and data experts.

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 <mm****@opalaconsult.com>
Nov 6 '05 #1
1 3329
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.5599999999999996), 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
Jun 15 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Greg Yasko | last post by:
Hi. Does anyone know if there's an equivalent of Perl's file::find module in Python? It traverses a directory. I've googled extensively and checked this newsgroup and can't find anything like it...
13
by: Paulo Pinto | last post by:
Hi, does anyone know of a Python package that is able to load XML like the XML::Simple Perl package does? For those that don't know it, this package maps the XML file to a dictionary.
7
by: Edward wijaya | last post by:
Hi, Is there any equivalent of it in Python? Thanks so much for your time. Regards, Edward WIJAYA
12
by: Gary Nutbeam | last post by:
I've noticed that the Perl camp has a very nice web/database environment called Maypole. Ruby has the Rails environment which on the surface seems similar to Maypole. I can't find anything in...
0
by: Eric | last post by:
I've got a weird problem, regardless of how often I enter: perl -MCPAN -e 'install "Data::Dumper"' I never get a message telling me that it is up-to-date. It will always try to reinstall even...
14
by: horos | last post by:
hey all, I'm a heavy perl user, not so much a java script user, and was wondering... perl has an extremely nice utility called Data::Dumper, which allows you to dump out the contents of an...
0
by: JohnLucas | last post by:
Hi all, I have just started working with the XML::Simple module to parse an XML file. I'm trying to pull some values from the file that I need in another program. The problem is that the XML...
1
by: srinivasan srinivas | last post by:
Thanks, Srini Bollywood, fun, friendship, sports and more. You name it, we have it on http://in.promos.yahoo.com/groups/bestofyahoo/
2
BeemerBiker
by: BeemerBiker | last post by:
I cannot get the following code to work unless I (1) Change <id> to anything else, or (2) Add an empty section to the bottom of my xml file. Could this be a bug in 5.10.1 ActivePerl or my test...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.