import pickle
st=" "
with open("myfile.info","rb") as fh:
st=pickle.load(fh)
lst=st.split('o')
print(lst[0])
Please tell what's wrong in this program. It is returning error line-->
_pickle.UnpicklingError: invalid load key, '\xef'.
I have stored a pickled file named myfile.info containing a string. I want to get the string till 'o' and ignore the left behind string.
The string is --->
"This is my first line. This is my second line".
st=" "
with open("myfile.info","rb") as fh:
st=pickle.load(fh)
lst=st.split('o')
print(lst[0])
Please tell what's wrong in this program. It is returning error line-->
_pickle.UnpicklingError: invalid load key, '\xef'.
I have stored a pickled file named myfile.info containing a string. I want to get the string till 'o' and ignore the left behind string.
The string is --->
"This is my first line. This is my second line".