akeinhell
akeinhell

Reputation: 111

How to use python struct.unpack

I have a file with the following content

(dp1 
S'SomethingString1' 
p2
(dp3
S'SomethingString2' 
p4
I3
sS'SomethingString3' 
p5
I7105
sS'SomethingString4'
p6
I0

How do I get data from it using python "struct.unpack"

Upvotes: 0

Views: 673

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1121196

You have a pickle file, use the pickle module instead.

The struct module won't help here; that module is used for binary data packed following C struct conventions, and the pickle format you are looking at is textual.

Upvotes: 1

Related Questions