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


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  全栈测试之路  阅读(201)  评论(0)    收藏  举报

< 2025年7月 >
29 30 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31 1 2
3 4 5 6 7 8 9

导航

统计

点击右上角即可分享
微信分享提示