exchanging data btwn Python and lesser languages

Dominic Mitchell Dom.Mitchell at palmerharvey.co.uk
Tue Dec 7 11:57:22 EST 1999


Preston Landers <prestonlanders at my-deja.com> writes:
> As strange as it may sound, Python is not the only language used in our
> shop (who shall remain nameless to protect the guilty.)
> 
> I'm looking for a quick-n-dirty way to exchange data between Python and
> other languages, especially P*rl.  I don't have time to implement a
> full-blown XML solution, which is really what this problem calls for
> IMHO.
> 
> The data I want to exchange is pretty simple; mainly lists/arrays and
> dicts/hashes of integers (possibly longints), strings, and floats.  No
> fancy objects or anything.
> 
> I see that Python has an XDR module that may suit my needs, but I can't
> find the equivilent P*rl module...
> 
> Essentially I want to write out my data to a file, similar to pickle or
> marshal, and be able to read the data easily in popular languages.
> 
> What solution have people out there been using for this kind of
> problem?

An obvious quick hack suggests itself:  Write out data as Perl code so
that it can be eval'd in the Perl world.  Perl itself can do this with
it's Data::Dumper module.

Reading it back into python would be harder, though.
-- 
Dom Mitchell -- Palmer & Harvey McLane -- Unix Systems Administrator

"vi has two modes the one in which it beeps and the one in which it doesnt."
	-- Anon.



More information about the Python-list mailing list