把txt内容导入plist文件
用python代码,把txt文件的每一行,导入plist文件.
#!/usr/bin/python # -*- coding: utf-8 -*- import json, urllib from urllib import urlencode import random import os,sys reload(sys) sys.setdefaultencoding('utf-8')
def main():
f = open('res.txt','r') text_lines = f.readlines() i = 10 for line in text_lines: os.system('/usr/libexec/PlistBuddy -c "Add :%s string %s" NewPlist.plist' % (i,line)) i = i + 1
if name == 'main':
main()