August 31st, 2012, 06:58 AM
Join Date: Aug 2012
Time spent in forums: 16 m 58 sec
Reputation Power: 0
Reading & writting *.pkg files
I am a beginner to python (1 day old)
I have a file with .pkg extension. I would like to read that file and search a line & delete that line. I found a code in one of the forum. I am able to run that code but my entire my.pkg file is getting corrupted.
my.pkg file has lot of special charcets in it.
Is there any way to read a .pkg files and edit that file using python?
Here is the code which got in one of the forums.
f = open("my.pkg","r")
lines = f.readlines()
f = open("my.pkg","w")
for line in lines:
if line!='"acd213211"-"X:\\abcd\\sadadfa\\5656\\7x068686860\\asdfas.xml", GGG, WWWW"' + "\n":
Kindly help me in resolving this issue.
Thanks in advance.