-
Notifications
You must be signed in to change notification settings - Fork 3
/
unpickle.py
35 lines (26 loc) · 872 Bytes
/
unpickle.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
#******************************************************************************
#
# unpickle.py
#
#******************************************************************************
import bz2
import contextlib
import pickle
import sys
#******************************************************************************
#
# unpickle
#
#******************************************************************************
def unpickle( fileName ):
with contextlib.closing( bz2.BZ2File( fileName, 'rb' ) ) as pickleFile:
result = repr( pickle.load( pickleFile ) )
print( result.replace( ',', ',\n' ) )
#******************************************************************************
#
# __main__
#
#******************************************************************************
if __name__ == '__main__':
unpickle( sys.argv[ 1 ] )