I have read that I can read pickles that were dumped in python 2.7 in python 3 using
content = pickle.load(o, encoding='latin1')
Obviously, I can read pickles that were dumped in python 3 using
content = pickle.load(o)
My problem is, I can't know the source of my pickle. It could be either one.
How can I test which type of pickle I am trying to read in order to use the correct method?