我的编程空间,编程开发者的网络收藏夹
学习永远不晚

使用Python读取plist文件并分割

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

使用Python读取plist文件并分割

plist文件简介

根据百度百科介绍,plist是一种文件形式,通常用于储存用户设置,也可以用于存储捆绑的信息,该功能在旧式的Mac OS中是由资源分支提供的。由于Plist中存储的数据是抽象的,其采用的文件格式可以不止一种。
分析plist文件结构可知,其本质是XML文档,因而我们可以使用XML解析器分析plist文件,读取各个图片的信息并将原图切割即可。

下文例子所用到的Python库

xml.etree
PIL(pillow, 可使用pip install pillow安装)

相应的Python代码

# -*- coding: UTF-8 -*

from xml.etree import ElementTree
from PIL import Image
import argparse
import os
import sys

class PlistParser:
    def __init__(self, plistPath, imagePath, outputDirPath):
        self.plistPath = plistPath
        self.imagePath = imagePath
        self.outputDirPath = outputDirPath


    def convertTreeToDict(self, tree):
        d = {}  # 返回值是一个dict
        for index, item in enumerate(tree):  # 遍历整棵XML树
            if item.tag == 'key':  # 如果该item的tag为'key'
                # 根据下一个结点的tag值不同,放在dict的不同位置上
                if tree[index + 1].tag == 'string':
                    d[item.text] = tree[index + 1].text
                elif tree[index + 1].tag == 'true':
                    d[item.text] = True
                elif tree[index + 1].tag == 'false':
                    d[item.text] = False
                elif tree[index + 1].tag == 'dict':
                    d[item.text] = self.convertTreeToDict(tree[index + 1])  # 递归下去
            elif item.tag == 'dict' and item._children[0].text == 'frames':
                d = self.convertTreeToDict(item)

        return d

    def splitImageFromPlist(self):
        targetFileDir = self.outputDirPath
        if targetFileDir is None:
            targetFileDir = self.plistPath.replace('.plist', '')
            if not os.path.isdir(targetFileDir):  # 如果不存在该目录
                os.mkdir(targetFileDir)  # 新建一个目录

        class="lazy" data-srcImg = Image.open(self.imagePath)  # 打开图像
        plistContentStr = open(self.plistPath, 'r').read()  # 读取plist文件
        plistXMLTree = ElementTree.fromstring(plistContentStr)  # 转换成XML树
        plistDict = self.convertTreeToDict(plistXMLTree)  # 获取dict

        for k, v in plistDict['frames'].items():
            posi_str = str(v['frame'])  # 获取表示位置的str
            posi_rect = posi_str.replace('{', '').replace('}', '').split(',')
            width = int(posi_rect[3] if v['rotated'] else posi_rect[2])
            height = int(posi_rect[2] if v['rotated'] else posi_rect[3])
            boundingBox = (
                int(posi_rect[0]),
                int(posi_rect[1]),
                int(posi_rect[0]) + width,
                int(posi_rect[1]) + height
            )

            rectImage = class="lazy" data-srcImg.crop(boundingBox)
            if v['rotated']:
                rectImage = rectImage.rotate(90)

            # outfile = os.path.join(targetFileDir, k)
            outfile = targetFileDir + '\\' + k
            dirPath = outfile.partition('/')[0]
            if not dirPath.endswith('png') and not os.path.isdir(dirPath):
                os.mkdir(dirPath)
            rectImage.save(outfile)


# 在该路径中寻找所有plist文件
def findPlistFile(path):
    l = []
    for x in os.listdir(path):
        if os.path.isfile(path + '\\' + x):
            if x.endswith('.plist') and not x.startswith('.'):
                l.append(path + '\\' + x)
        elif os.path.isdir(path + '\\' + x):
            l.extend(findPlistFile(path + '\\' + x))

    return l


if __name__ == '__main__':
    parser = argparse.ArgumentParser(usage='please use plistCutter.py -h to get help information.')
    parser.add_argument('-dir', help='Specify a directory file path you would like to find')


    args = parser.parse_args()
    dir = args.dir

    if dir is None and not os.path.isdir(dir):
        print('error: %s is not an valid dir or dosen\'t exist.')
        sys.exit(1)

    l = findPlistFile(dir)
    for x in l:
        plistPath = x
        pngPath = x.replace('.plist', '.png')
        if os.path.exists(pngPath):
            dirPath = str.format('res\\%s' % x.replace('.plist', '').rpartition('\\')[2])
            if not os.path.isdir(dirPath):
                os.mkdir(dirPath)
            PlistParser(plistPath, pngPath, dirPath).splitImageFromPlist()

    print('Done.')

使用方法以及注意

本代码是读取一个目录的路径,找出所有的plist文件,并将所有切割后的图像当在当前目录(py文件所处的目录)的res文件夹中。
注意的是,plist文件名和原图名必须一致,如果不一致需要对代码或者对文件名做一些相应的修改。
使用方式是 python 文件名.py -dir 目录路径。
比如,plist文件都处于目录D:\plists中,将以上代码保存为plistCutter.py,在当前目录使用命令行输入
python plistCutter.py -dir D:\plists
程序运行结束后,在当前目录可以看到一个res文件夹,打开该文件夹就是切割后的所有图像了。

附录:下文例子所使用的plist文件之一

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>frames</key>
    <dict>
        <key>newtheme_CN.png</key>
        <dict>
            <key>frame</key>
            <string>{{826,52},{410,114}}</string>
            <key>offset</key>
            <string>{0,5}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{35,18},{410,114}}</string>
            <key>sourceSize</key>
            <string>{480,160}</string>
        </dict>
        <key>newtheme_EN.png</key>
        <dict>
            <key>frame</key>
            <string>{{414,50},{410,114}}</string>
            <key>offset</key>
            <string>{0,5}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{35,18},{410,114}}</string>
            <key>sourceSize</key>
            <string>{480,160}</string>
        </dict>
        <key>newtheme_TW.png</key>
        <dict>
            <key>frame</key>
            <string>{{2,46},{410,114}}</string>
            <key>offset</key>
            <string>{0,5}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{35,18},{410,114}}</string>
            <key>sourceSize</key>
            <string>{480,160}</string>
        </dict>
        <key>theend_bg.png</key>
        <dict>
            <key>frame</key>
            <string>{{2888,1032},{960,640}}</string>
            <key>offset</key>
            <string>{0,0}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{0,0},{960,640}}</string>
            <key>sourceSize</key>
            <string>{960,640}</string>
        </dict>
        <key>theend_bg_CN.png</key>
        <dict>
            <key>frame</key>
            <string>{{2568,98},{870,146}}</string>
            <key>offset</key>
            <string>{7,172}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{52,75},{870,146}}</string>
            <key>sourceSize</key>
            <string>{960,640}</string>
        </dict>
        <key>theend_bg_EN.png</key>
        <dict>
            <key>frame</key>
            <string>{{872,192},{848,170}}</string>
            <key>offset</key>
            <string>{13,170}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{69,65},{848,170}}</string>
            <key>sourceSize</key>
            <string>{960,640}</string>
        </dict>
        <key>theend_bg_TW.png</key>
        <dict>
            <key>frame</key>
            <string>{{2,168},{868,148}}</string>
            <key>offset</key>
            <string>{8,173}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{54,73},{868,148}}</string>
            <key>sourceSize</key>
            <string>{960,640}</string>
        </dict>
        <key>theend_home.png</key>
        <dict>
            <key>frame</key>
            <string>{{2130,2},{72,72}}</string>
            <key>offset</key>
            <string>{-11,10}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{13,14},{72,72}}</string>
            <key>sourceSize</key>
            <string>{120,120}</string>
        </dict>
        <key>theend_rate_CN.png</key>
        <dict>
            <key>frame</key>
            <string>{{2596,2},{190,80}}</string>
            <key>offset</key>
            <string>{-2,2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{23,18},{190,80}}</string>
            <key>sourceSize</key>
            <string>{240,120}</string>
        </dict>
        <key>theend_rate_EN.png</key>
        <dict>
            <key>frame</key>
            <string>{{2396,2},{198,80}}</string>
            <key>offset</key>
            <string>{3,2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{24,18},{198,80}}</string>
            <key>sourceSize</key>
            <string>{240,120}</string>
        </dict>
        <key>theend_rate_TW.png</key>
        <dict>
            <key>frame</key>
            <string>{{2204,2},{190,80}}</string>
            <key>offset</key>
            <string>{-2,2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{23,18},{190,80}}</string>
            <key>sourceSize</key>
            <string>{240,120}</string>
        </dict>
        <key>theend_sina_CN.png</key>
        <dict>
            <key>frame</key>
            <string>{{3194,2},{196,80}}</string>
            <key>offset</key>
            <string>{-5,2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{17,18},{196,80}}</string>
            <key>sourceSize</key>
            <string>{240,120}</string>
        </dict>
        <key>theend_sina_EN.png</key>
        <dict>
            <key>frame</key>
            <string>{{2986,2},{206,80}}</string>
            <key>offset</key>
            <string>{-1,2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{16,18},{206,80}}</string>
            <key>sourceSize</key>
            <string>{240,120}</string>
        </dict>
        <key>theend_sina_TW.png</key>
        <dict>
            <key>frame</key>
            <string>{{2788,2},{196,80}}</string>
            <key>offset</key>
            <string>{-5,2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{17,18},{196,80}}</string>
            <key>sourceSize</key>
            <string>{240,120}</string>
        </dict>
        <key>导入萝卜2/theend_tov2_CN.png</key>
        <dict>
            <key>frame</key>
            <string>{{898,418},{894,252}}</string>
            <key>offset</key>
            <string>{0,151}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{0,43},{894,252}}</string>
            <key>sourceSize</key>
            <string>{894,640}</string>
        </dict>
        <key>导入萝卜2/theend_tov2_EN.png</key>
        <dict>
            <key>frame</key>
            <string>{{2,364},{894,248}}</string>
            <key>offset</key>
            <string>{0,153}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{0,43},{894,248}}</string>
            <key>sourceSize</key>
            <string>{894,640}</string>
        </dict>
        <key>导入萝卜2/theend_tov2_TW.png</key>
        <dict>
            <key>frame</key>
            <string>{{2678,246},{894,248}}</string>
            <key>offset</key>
            <string>{0,153}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{0,43},{894,248}}</string>
            <key>sourceSize</key>
            <string>{894,640}</string>
        </dict>
        <key>导入萝卜2/theend_tov2_bg.png</key>
        <dict>
            <key>frame</key>
            <string>{{1926,1032},{960,640}}</string>
            <key>offset</key>
            <string>{0,0}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{0,0},{960,640}}</string>
            <key>sourceSize</key>
            <string>{960,640}</string>
        </dict>
        <key>导入萝卜2/theend_tov2_close_normal.png</key>
        <dict>
            <key>frame</key>
            <string>{{2060,2},{68,68}}</string>
            <key>offset</key>
            <string>{1,3}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{17,3},{68,68}}</string>
            <key>sourceSize</key>
            <string>{100,80}</string>
        </dict>
        <key>导入萝卜2/theend_tov2_close_pressed.png</key>
        <dict>
            <key>frame</key>
            <string>{{1990,2},{68,68}}</string>
            <key>offset</key>
            <string>{1,3}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{17,3},{68,68}}</string>
            <key>sourceSize</key>
            <string>{100,80}</string>
        </dict>
        <key>最终通关/theend2_bg.png</key>
        <dict>
            <key>frame</key>
            <string>{{964,946},{960,640}}</string>
            <key>offset</key>
            <string>{0,0}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{0,0},{960,640}}</string>
            <key>sourceSize</key>
            <string>{960,640}</string>
        </dict>
        <key>最终通关/theend2_bg_CN.png</key>
        <dict>
            <key>frame</key>
            <string>{{3244,496},{726,534}}</string>
            <key>offset</key>
            <string>{28,-10}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{145,63},{726,534}}</string>
            <key>sourceSize</key>
            <string>{960,640}</string>
        </dict>
        <key>最终通关/theend2_bg_EN.png</key>
        <dict>
            <key>frame</key>
            <string>{{1794,418},{720,526}}</string>
            <key>offset</key>
            <string>{21,-11}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{141,68},{720,526}}</string>
            <key>sourceSize</key>
            <string>{960,640}</string>
        </dict>
        <key>最终通关/theend2_bg_TW.png</key>
        <dict>
            <key>frame</key>
            <string>{{2516,496},{726,534}}</string>
            <key>offset</key>
            <string>{28,-10}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{145,63},{726,534}}</string>
            <key>sourceSize</key>
            <string>{960,640}</string>
        </dict>
        <key>最终通关/theend2_close_normal.png</key>
        <dict>
            <key>frame</key>
            <string>{{2060,2},{68,68}}</string>
            <key>offset</key>
            <string>{1,3}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{17,3},{68,68}}</string>
            <key>sourceSize</key>
            <string>{100,80}</string>
        </dict>
        <key>最终通关/theend2_close_pressed.png</key>
        <dict>
            <key>frame</key>
            <string>{{1990,2},{68,68}}</string>
            <key>offset</key>
            <string>{1,3}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{17,3},{68,68}}</string>
            <key>sourceSize</key>
            <string>{100,80}</string>
        </dict>
        <key>最终通关/theend2_tweibo_normal.png</key>
        <dict>
            <key>frame</key>
            <string>{{3392,2},{94,96}}</string>
            <key>offset</key>
            <string>{1,-4}</string>
            <key>rotated</key>
            <true/>
            <key>sourceColorRect</key>
            <string>{{29,31},{94,96}}</string>
            <key>sourceSize</key>
            <string>{150,150}</string>
        </dict>
        <key>最终通关/theend2_tweibo_press.png</key>
        <dict>
            <key>frame</key>
            <string>{{3808,2},{138,132}}</string>
            <key>offset</key>
            <string>{0,1}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{6,8},{138,132}}</string>
            <key>sourceSize</key>
            <string>{150,150}</string>
        </dict>
        <key>最终通关/theend2_wechat_disable.png</key>
        <dict>
            <key>frame</key>
            <string>{{3594,2},{102,102}}</string>
            <key>offset</key>
            <string>{1,-1}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{25,25},{102,102}}</string>
            <key>sourceSize</key>
            <string>{150,150}</string>
        </dict>
        <key>最终通关/theend2_wechat_normal.png</key>
        <dict>
            <key>frame</key>
            <string>{{3490,2},{102,102}}</string>
            <key>offset</key>
            <string>{1,-1}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{25,25},{102,102}}</string>
            <key>sourceSize</key>
            <string>{150,150}</string>
        </dict>
        <key>最终通关/theend2_wechat_press.png</key>
        <dict>
            <key>frame</key>
            <string>{{3948,2},{134,138}}</string>
            <key>offset</key>
            <string>{-1,5}</string>
            <key>rotated</key>
            <true/>
            <key>sourceColorRect</key>
            <string>{{7,1},{134,138}}</string>
            <key>sourceSize</key>
            <string>{150,150}</string>
        </dict>
        <key>最终通关/theend2_weibo_normal.png</key>
        <dict>
            <key>frame</key>
            <string>{{3698,2},{108,108}}</string>
            <key>offset</key>
            <string>{-2,2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{19,19},{108,108}}</string>
            <key>sourceSize</key>
            <string>{150,150}</string>
        </dict>
        <key>最终通关/theend2_weibo_press.png</key>
        <dict>
            <key>frame</key>
            <string>{{1828,62},{148,140}}</string>
            <key>offset</key>
            <string>{-1,5}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{0,0},{148,140}}</string>
            <key>sourceSize</key>
            <string>{150,150}</string>
        </dict>
        <key>貌似通关/theend1_bg.png</key>
        <dict>
            <key>frame</key>
            <string>{{2,672},{960,640}}</string>
            <key>offset</key>
            <string>{0,0}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{0,0},{960,640}}</string>
            <key>sourceSize</key>
            <string>{960,640}</string>
        </dict>
        <key>貌似通关/theend1_bg_CN.png</key>
        <dict>
            <key>frame</key>
            <string>{{1978,84},{588,128}}</string>
            <key>offset</key>
            <string>{0,235}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{186,21},{588,128}}</string>
            <key>sourceSize</key>
            <string>{960,640}</string>
        </dict>
        <key>貌似通关/theend1_bg_EN.png</key>
        <dict>
            <key>frame</key>
            <string>{{1722,246},{954,170}}</string>
            <key>offset</key>
            <string>{-3,235}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{0,0},{954,170}}</string>
            <key>sourceSize</key>
            <string>{960,640}</string>
        </dict>
        <key>貌似通关/theend1_bg_TW.png</key>
        <dict>
            <key>frame</key>
            <string>{{1238,62},{588,128}}</string>
            <key>offset</key>
            <string>{0,235}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{186,21},{588,128}}</string>
            <key>sourceSize</key>
            <string>{960,640}</string>
        </dict>
        <key>貌似通关/theend1_btn_disable.png</key>
        <dict>
            <key>frame</key>
            <string>{{1790,2},{198,58}}</string>
            <key>offset</key>
            <string>{0,2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{11,19},{198,58}}</string>
            <key>sourceSize</key>
            <string>{220,100}</string>
        </dict>
        <key>貌似通关/theend1_btn_normal.png</key>
        <dict>
            <key>frame</key>
            <string>{{1590,2},{198,58}}</string>
            <key>offset</key>
            <string>{0,2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{11,19},{198,58}}</string>
            <key>sourceSize</key>
            <string>{220,100}</string>
        </dict>
        <key>貌似通关/theend1_btn_press.png</key>
        <dict>
            <key>frame</key>
            <string>{{1390,2},{198,58}}</string>
            <key>offset</key>
            <string>{0,2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{11,19},{198,58}}</string>
            <key>sourceSize</key>
            <string>{220,100}</string>
        </dict>
        <key>貌似通关/theend1_close_normal.png</key>
        <dict>
            <key>frame</key>
            <string>{{2060,2},{68,68}}</string>
            <key>offset</key>
            <string>{1,3}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{17,3},{68,68}}</string>
            <key>sourceSize</key>
            <string>{100,80}</string>
        </dict>
        <key>貌似通关/theend1_close_pressed.png</key>
        <dict>
            <key>frame</key>
            <string>{{1990,2},{68,68}}</string>
            <key>offset</key>
            <string>{1,3}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{17,3},{68,68}}</string>
            <key>sourceSize</key>
            <string>{100,80}</string>
        </dict>
        <key>貌似通关/theend1_tweibo_CN.png</key>
        <dict>
            <key>frame</key>
            <string>{{1238,2},{150,48}}</string>
            <key>offset</key>
            <string>{-2,-2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{33,28},{150,48}}</string>
            <key>sourceSize</key>
            <string>{220,100}</string>
        </dict>
        <key>貌似通关/theend1_tweibo_EN.png</key>
        <dict>
            <key>frame</key>
            <string>{{1086,2},{150,48}}</string>
            <key>offset</key>
            <string>{1,-2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{36,28},{150,48}}</string>
            <key>sourceSize</key>
            <string>{220,100}</string>
        </dict>
        <key>貌似通关/theend1_tweibo_TW.png</key>
        <dict>
            <key>frame</key>
            <string>{{934,2},{150,48}}</string>
            <key>offset</key>
            <string>{-2,-2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{33,28},{150,48}}</string>
            <key>sourceSize</key>
            <string>{220,100}</string>
        </dict>
        <key>貌似通关/theend1_wechat_CN.png</key>
        <dict>
            <key>frame</key>
            <string>{{788,2},{144,46}}</string>
            <key>offset</key>
            <string>{-5,1}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{33,26},{144,46}}</string>
            <key>sourceSize</key>
            <string>{220,100}</string>
        </dict>
        <key>貌似通关/theend1_wechat_EN.png</key>
        <dict>
            <key>frame</key>
            <string>{{650,2},{136,46}}</string>
            <key>offset</key>
            <string>{0,1}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{42,26},{136,46}}</string>
            <key>sourceSize</key>
            <string>{220,100}</string>
        </dict>
        <key>貌似通关/theend1_wechat_TW.png</key>
        <dict>
            <key>frame</key>
            <string>{{504,2},{144,46}}</string>
            <key>offset</key>
            <string>{-5,1}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{33,26},{144,46}}</string>
            <key>sourceSize</key>
            <string>{220,100}</string>
        </dict>
        <key>貌似通关/theend1_weibo_CN.png</key>
        <dict>
            <key>frame</key>
            <string>{{338,2},{164,42}}</string>
            <key>offset</key>
            <string>{-4,2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{24,27},{164,42}}</string>
            <key>sourceSize</key>
            <string>{220,100}</string>
        </dict>
        <key>貌似通关/theend1_weibo_EN.png</key>
        <dict>
            <key>frame</key>
            <string>{{168,2},{168,42}}</string>
            <key>offset</key>
            <string>{-2,2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{24,27},{168,42}}</string>
            <key>sourceSize</key>
            <string>{220,100}</string>
        </dict>
        <key>貌似通关/theend1_weibo_TW.png</key>
        <dict>
            <key>frame</key>
            <string>{{2,2},{164,42}}</string>
            <key>offset</key>
            <string>{-4,2}</string>
            <key>rotated</key>
            <false/>
            <key>sourceColorRect</key>
            <string>{{24,27},{164,42}}</string>
            <key>sourceSize</key>
            <string>{220,100}</string>
        </dict>
    </dict>
    <key>metadata</key>
    <dict>
        <key>format</key>
        <integer>2</integer>
        <key>realTextureFileName</key>
        <string>accomplish-hd.png</string>
        <key>size</key>
        <string>{4096,4096}</string>
        <key>smartupdate</key>
        <string>$TexturePacker:SmartUpdate:385f24a324f9dd1d25e26bd65515da44:536e814ddb5dc3875f0d8a8b5df6b8da:d5e849a57a87ef53e500130d77376857$</string>
        <key>textureFileName</key>
        <string>accomplish-hd.png</string>
    </dict>
</dict>
</plist>

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

使用Python读取plist文件并分割

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

使用Python读取plist文件并分割

plist文件简介根据百度百科介绍,plist是一种文件形式,通常用于储存用户设置,也可以用于存储捆绑的信息,该功能在旧式的Mac OS中是由资源分支提供的。由于Plist中存储的数据是抽象的,其采用的文件格式可以不止一种。 分析plist
2023-01-31

python读取access文件并入库

Python读取access文件时和读取Excel文件不是很一样,当然用的工具也不一样,在读取excel中的数据时用的是xlrd,而读取access文件时用的则是pypyodbc。简要安装过程:1、首先要安装access驱动(AccessR
2023-01-31

Python 视频文件的分割和合并

import os;import time;os.system('start "wmplayer.exe", "F:\\abc.mp4"');--分割代码 start----import sys,os;kilobytes = 1024;me
2023-01-31

python如何读取文件并输出

在Python中,可以使用`open()`函数来打开一个文件,并可以通过读取文件的内容进行输出。下面是一个简单的示例代码:```python# 打开文件file = open("example.txt", "r")# 读取文件内容并输出co
2023-08-30

python如何使用fileinput读取文件

这篇文章主要介绍python如何使用fileinput读取文件,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!fileinput 是 Python 的内置模块,但我相信,不少人对它都是陌生的。今天我把 fileinpu
2023-06-14

大小文件读取并分页展示

1.读取小文件,并进行分页  商品|价格  飞机|1000  大炮|2000  迫击炮|1000  手枪|123  .....lis = []n = 10 #每页显示10条信息with open('小文件',mode='r',encodi
2023-01-31

如何使用Python读取xml文件

这篇文章主要介绍了如何使用Python读取xml文件,关于python读取xml文章很多,但大多文章都是贴一个xml文件,然后再贴个处理文件的代码希望这篇文章可以更通俗易懂的教如何使用python来读取xml文件
2023-05-15

使用python怎么读取txt文件

这期内容当中小编将会给大家带来有关使用python怎么读取txt文件,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。(1)txt的切割读取对应内容 (2)时间差计算txt文件如图:使用效果首先将原始tx
2023-06-14

怎么使用python open读取文件

要使用Python的open函数来读取文件,你需要使用以下步骤:1. 打开文件:使用open函数打开文件,并传入文件路径和打开模式作为参数。打开模式可以是'r'(读取模式)、'w'(写入模式)、'a'(追加模式)等。例如,要以读取模式打开名
2023-09-14

使用python怎么读取文件名

这篇文章给大家介绍使用python怎么读取文件名,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。python可以做什么Python是一种编程语言,内置了许多有效的工具,Python几乎无所不能,该语言通俗易懂、容易入门、
2023-06-14

怎么使用Python读取xml文件

本篇内容介绍了“怎么使用Python读取xml文件”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成! 什么是xml?xml即可扩展标记语言,它可
2023-07-06

python怎么读取mat文件并画图

在Python中,您可以使用`scipy.io`模块中的`loadmat`函数来读取MAT文件,并使用`matplotlib`模块来绘制图形。以下是一个读取MAT文件并绘制图形的示例代码:import scipy.ioimport m
2023-10-27

python操作xlsx格式文件并读取

之前给大家介绍过python高手之路python处理excel文件(方法汇总) Python操作Excel之xlsx文件 今天继续围绕python xlsx格式文件的操作方法给大家介绍,具体内容如下: 一.准备工作二 .xlrd库读取 首
2022-06-02

怎么用vbs分割与合并文本文件

这篇文章主要为大家展示了“怎么用vbs分割与合并文本文件”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“怎么用vbs分割与合并文本文件”这篇文章吧。然而想到其他地方再次下载时发现一次性导入几万个地
2023-06-08

Linux下怎么使用Python读取文件

这篇文章主要介绍“Linux下怎么使用Python读取文件”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“Linux下怎么使用Python读取文件”文章能帮助大家解决问题。不论是数据分析,数据可视化,
2023-06-27

关于Python中读取写入文件并进行文件

一、提前知识点在python中是同样和其他语言一样可以进行文件的读取写入操作,值得注意的是,Python中打开文件读取的方式有几种,分别是以下几种:1 f = open('username.txt')2 first_line = f.rea
2023-01-30

编程热搜

  • Python 学习之路 - Python
    一、安装Python34Windows在Python官网(https://www.python.org/downloads/)下载安装包并安装。Python的默认安装路径是:C:\Python34配置环境变量:【右键计算机】--》【属性】-
    Python 学习之路 - Python
  • chatgpt的中文全称是什么
    chatgpt的中文全称是生成型预训练变换模型。ChatGPT是什么ChatGPT是美国人工智能研究实验室OpenAI开发的一种全新聊天机器人模型,它能够通过学习和理解人类的语言来进行对话,还能根据聊天的上下文进行互动,并协助人类完成一系列
    chatgpt的中文全称是什么
  • C/C++中extern函数使用详解
  • C/C++可变参数的使用
    可变参数的使用方法远远不止以下几种,不过在C,C++中使用可变参数时要小心,在使用printf()等函数时传入的参数个数一定不能比前面的格式化字符串中的’%’符号个数少,否则会产生访问越界,运气不好的话还会导致程序崩溃
    C/C++可变参数的使用
  • css样式文件该放在哪里
  • php中数组下标必须是连续的吗
  • Python 3 教程
    Python 3 教程 Python 的 3.0 版本,常被称为 Python 3000,或简称 Py3k。相对于 Python 的早期版本,这是一个较大的升级。为了不带入过多的累赘,Python 3.0 在设计的时候没有考虑向下兼容。 Python
    Python 3 教程
  • Python pip包管理
    一、前言    在Python中, 安装第三方模块是通过 setuptools 这个工具完成的。 Python有两个封装了 setuptools的包管理工具: easy_install  和  pip , 目前官方推荐使用 pip。    
    Python pip包管理
  • ubuntu如何重新编译内核
  • 改善Java代码之慎用java动态编译

目录