~ubuntu-branches/ubuntu/wily/bandit/wily-proposed

« back to all changes in this revision

Viewing changes to examples/marshal_deserialize.py

  • Committer: Package Import Robot
  • Author(s): Dave Walker (Daviey)
  • Date: 2015-07-22 09:01:39 UTC
  • Revision ID: package-import@ubuntu.com-20150722090139-fl0nluy0x8m9ctx4
Tags: upstream-0.12.0
ImportĀ upstreamĀ versionĀ 0.12.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import marshal
 
2
import tempfile
 
3
 
 
4
 
 
5
serialized = marshal.dumps({'a': 1})
 
6
print(marshal.loads(serialized))
 
7
 
 
8
file_obj = tempfile.TemporaryFile()
 
9
marshal.dump(range(5), file_obj)
 
10
file_obj.seek(0)
 
11
print(marshal.load(file_obj))
 
12
file_obj.close()