我的Python代码有问题。我有一个plist文件。在Python中解析plist文件
的Info.plist
Apple Car Version
1.0
Last Backup Date
Product Type
iPad2,5
Product Version
9.3.1
我的Python代码:
import os
import plistlib
def main():
fileName=os.path.expanduser('Info.plist')
if os.path.exists(fileName):
pl=plistlib.readPlist(fileName)
if 'Product Version' in pl:
print('The aString value is %s\n' % pl['Apple Car Version'])
else:
print('There is no Apple Car Version in the plist\n')
else:
print('%s does not exist, so can\'t be read' % fileName)
if __name__ == '__main__':
main()
好了,所以我写了一些代码,但我现在面临着更大的问题,我发现它不是我的代码,但我的plist plist中的Last Backup Date会导致错误。有没有办法,我只能parsh琴弦,没有别的喜欢
通过这个plist中是由iTunes进行的方式,如果你想知道