0

I have a list of directories named dirList. I need to filter and sort before I pickle I think. This is what I've got.

fileHandle = open( 'dirList.txt', 'w' )
fileHandle.write( 'yadda yadda yadda intro' )
cPickle.dump(mu1List, fileHandle)
fileHandle.close()

the mu1List is declared at the beginning and it is a thousand or so part list.

When it prints to the dirList.txt file it has S1(P1 'stringItem', P2 'stringItem1', ...etc)
Is there a way to filter out the P#'s and the items not surrounded by apostrophes? before it gets printed to the .txt? Thanks

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Gribouillis
0

The pickle format is encoded. If you want to output the list in plain text, you could try this

from pprint import pprint
pprint(mu1List, fileHandle)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.