简化ui文件转换写法
2015-12-29 15:14
429 查看
在命令行敲一串长的命令。枯燥麻烦。
使用Python编写一个程序,随便练练语法。
#coding:utf-8 import sys import os import subprocess if len(sys.argv) == 2: #节省输入,不输入后缀 #直接使用參数的第2个值 file = sys.argv[1] + '.ui' #检查输入文件是否存在 if not os.path.exists(file): print('input file is not exited.') exit(1) #分离文件名称和扩展名 #本转换,和UI文件在同一文件夹 f, ext = os.path.splitext(file) dist = f + '.py' #运行的命令 cmd = 'pyuic4 ' + file + ' -o ui/' + dist #使用subprocess模块,os.command也能够用 code = subprocess.call(cmd, shell=True) #输出结果 if code == 0: print('%s --> %s success.' % (file, dist)) else: print('%s --> %s failure.' % (file, dist))
使用Python编写一个程序,随便练练语法。
相关文章推荐
- ios学习笔记UITableViewCell重用时出现重影的解决方案
- 用Fragment制作的Tab页面产生的UI重叠问题
- [友盟微博分享]does not contain bitcode. You must rebuild it with
- 键盘增加监听,UIButton随键盘位移
- iPhone 如何使用UIImageView播放动画,并停留在之后一张图片并添加播放结束时的事件
- HDU1159 Common Subsequence(动态规划)
- UILabel加载HTML文本和字体颜色修改
- Android官网:Configuring Gradle Builds英译
- UIViewController的生命周期及iOS程序执行顺序
- UGUI
- Burp Suite使用介绍——Proxy功能(二)
- oc UIButton绑定事件并传值
- Map集合中value()方法与keySet()、entrySet()区别
- 制作带initrd的uImage
- Burp Suite使用介绍——Proxy功能(一)
- git clone error: The requested URL returned error: 401 Unauthorized while accessing
- Jira plugin cannot startup due to "Error parsing class file"
- 执行update操作的话,就会报“Connection is read-only. Queries leading to data modification are not allowed”的异常。
- POJ 3481 Double queue
- 如何在UICollectionView reloadData后找到的某个cell