nolang

把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()

posted on 2019-09-05 09:10  全栈测试之路  阅读(197)  评论(0编辑  收藏  举报

导航