stringified cPickle

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Bear

    #1

    stringified cPickle

    I'm rather new to pickling but I have some dictionaries and lists I want to
    package and send to another process (on another machine).

    I was hoping I could just send a stringified pickle. However, the examples
    in the doc have:
    [color=blue][color=green][color=darkred]
    >>> import pickle
    >>> pickle.dump(obj ,open('save.p', 'w'))[/color][/color][/color]

    I don't really want to write to a file. I know I could write to sys.stdout.
    But I'd rather collect the string and do some garbage collect, etc before I
    exit the script.

    Is there a way to have cPickle just hand me a string?

    --
    David Bear
    -- let me buy your intellectual property, I want to own your thoughts --
  • Chris Mellon

    #2
    Re: stringified cPickle

    On 11/17/05, David Bear <david.bear@asu .edu> wrote:[color=blue]
    > I'm rather new to pickling but I have some dictionaries and lists I want to
    > package and send to another process (on another machine).
    >
    > I was hoping I could just send a stringified pickle. However, the examples
    > in the doc have:
    >[color=green][color=darkred]
    > >>> import pickle
    > >>> pickle.dump(obj ,open('save.p', 'w'))[/color][/color]
    >
    > I don't really want to write to a file. I know I could write to sys.stdout.
    > But I'd rather collect the string and do some garbage collect, etc beforeI
    > exit the script.
    >
    > Is there a way to have cPickle just hand me a string?
    >
    > --
    > David Bear
    > -- let me buy your intellectual property, I want to own your thoughts --
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >[/color]

    pickle.dumps

    Comment

    • Chris Mellon

      #3
      Re: stringified cPickle

      On 11/17/05, David Bear <david.bear@asu .edu> wrote:[color=blue]
      > I'm rather new to pickling but I have some dictionaries and lists I want to
      > package and send to another process (on another machine).
      >
      > I was hoping I could just send a stringified pickle. However, the examples
      > in the doc have:
      >[color=green][color=darkred]
      > >>> import pickle
      > >>> pickle.dump(obj ,open('save.p', 'w'))[/color][/color]
      >
      > I don't really want to write to a file. I know I could write to sys.stdout.
      > But I'd rather collect the string and do some garbage collect, etc beforeI
      > exit the script.
      >
      > Is there a way to have cPickle just hand me a string?
      >
      > --
      > David Bear
      > -- let me buy your intellectual property, I want to own your thoughts --
      > --
      > http://mail.python.org/mailman/listinfo/python-list
      >[/color]

      pickle.dumps

      Comment

      Working...