Code marshalling question.

brueckd at brueckd at
Tue Oct 8 18:21:08 CEST 2002

On Tue, 8 Oct 2002 sismex01 at wrote:

> I've had this question for a while.  Is there a way to marshal
> a segment of code into a string, which can then be transported
> (via whatever method), such that the code segment can be
> unmarshalled later and executed?

The marshal module can marshal code objects:

def f(x):
  print x

import marshal

But IMO an even better approach is to just send the .py file, save it to 
some local file, and then import that module.


More information about the Python-list mailing list