[BangPypers] plist files

Python User python.user.01 at gmail.com
Mon Mar 14 12:51:07 CET 2011


Hi All,

I have a plist file, test.plist, All I want is read the scriptNO tag value
12345 and replace it with 67899. Can any one please help me out for
this. The file content is

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//test//EN" "
http://www.test.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>command</key>
<string>GetTestScriptData</string>
<key>comments</key>
<string>Get Test Script</string>
<key>opParam</key>
<dict>
<key>scriptNO</key>
<string>12345</string>
<key>columnNames</key>
<string>Test case</string>
<key>fetchKey</key>
<string>1</string>
<key>fetchData</key>
<string>1</string>
</dict>
</dict>
</array>
</plist>

I was using the below code to read the plist file, but I am not able  to
search the scriptNo and replace it with other value.

import plistlib
file = ('/Users/me/Desktop/test.plist')
plist = plistlib.readPlist(file)
print plist

Please help me out to solve this. Thanks In Advance.


More information about the BangPypers mailing list