This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to convert a pkl file into txt file using cPickle in python

Hi!

I am trying to convert a .pkl file into text file using cPickle module in python. Using the code

>>> import cPickle
>>> data=cPickle.load(open("input.pkl","rb"))
>>> output=open("write.txt","w")
>>> output.write(str(data))
>>> output.flush()
>>> output.close()

But it is getting converted partially (only few lines of pkl file are getting converted into text format).

is there any way? please suggest.

file conversion

Maybe the str() function prints only part of the data? What kind of data is it? maybe you need to iterate through it.

So try iterating it and writing each element

Is this related to bioinformatics? If not, you may get more direct responses if you edit your question to include the relevance to bioinformatics, or ask this on stack overflow.

Hello dnyanepooja138!

We believe that this post does not fit the main topic of this site.

This does not look related to bioinformatics.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

0 answers

No answers yet.

Log in to answer this question.