Python Intro
来源:互联网 发布:neta软件百度云 编辑:程序博客网 时间:2024/05/16 16:56
#!/usr/bin/python3
import getopt, sys, urllib, time
import os,platform
def extract_animation(fname):
ofile = fname + ".txt"
bWritable = False;
try:
f0 = open(fname, 'r')
f1 = open(ofile, 'w')
for line in f0:
ana = line[1:10]
brk = line[0:1]
if(ana == "animation"):
bWritable = True
line=line[14:]
if(bWritable):
f1.write(line);
if(brk == "}"):
bWritable = False
except IOError:
print("exception occurred")
f0.close()
f1.close()
def main(argv):
ll = len(argv)
name, ext = os.path.splitext(argv[0])
# print(name, "-----", ext)
for ifile in argv[1:]:
extract_animation(ifile)
ofname = name + "_" + "merge" + ".js"
bMergable = False
bAnimation = False
try:
f0 = open(argv[0], 'r')
f1 = open(ofname, 'w')
for line in f0:
ana = line[1:10]
first = line[0:1]
if(ana == "animation"):
line0 = "\"animations\" : "
line1 = line[14:]
line = line0 + "[" + line1
bAnimation = True
if(bAnimation):
if(first == "}"):
f1.write("}")
for item in argv[1:]:
f1.write(",");
ifile = item + ".txt"
try:
ff = open(ifile, 'r')
for rr in ff:
f1.write(rr)
except IOError:
print("exception occurred")
os.remove(ifile)
f1.write("]")
bAnimation = False
else:
f1.write(line)
else:
f1.write(line)
f0.close()
f1.close()
except IOError:
print("exception occurred")
#-------------------------------
if __name__ == "__main__":
platform_arch=platform.architecture()
platform_system=platform.system()
platform_version=platform.version()
platform_machine=platform.machine()
platform_dist=platform.dist()
platform_node=platform.node()
platform_uname=platform.uname()
platform_python_version=platform.python_version()
codename = sys.getdefaultencoding()
print("codename = [%s]\n" %(codename))
print("arch = [%s %s]\n" %(platform_arch))
print("system = [%s]\n" %(platform_system))
print("version = [%s]\n" %(platform_version))
print("machine = [%s]\n" %(platform_machine))
print("dist = [%s %s %s]\n" %(platform_dist))
print("node = [%s]\n" %(platform_node))
print("uname = [%s %s %s %s %s %s]\n" %(platform_uname))
print("python_version = [%s]\n" %(platform_python_version))
main(sys.argv[1:])
# extract_animation('t0.js')
- Python intro
- Python Intro
- Python Intro
- Python Intro
- Python Intro
- Python Intro
- Python Intro
- Python Effective Programming - Intro
- Python-0(Intro)
- Python Intro - zip object
- Python DM Learning Intro
- Python Intro - C/C++ Extension
- Python Intro - Numpy Example 01
- Python Intro - Numpy function vectorize
- Python Intro - Numpy array shape
- Python Intro - ipdb debug install
- Intro
- intro
- bzoj 2194: 快速傅立叶之二 (FFT)
- Ubuntu解压命令集
- python enumerate()
- laravel学习3
- 使用_CrtSetDbgFlag检测内存泄露
- Python Intro
- java中String new和直接赋值的区别
- Graph cuts在视差估计中的应用
- POJ 3311 Hie with the Pie
- win下安装Scrapy最新版
- 数据结构和算法概述
- 347. Top K Frequent Elements
- python 利用模拟退火算法求解TSP最短路径
- 微信公众号,管理者账号微信号丢失如何找回