摘要:
MoveTo和MoveBy可以使精灵移动,区别在于MoveTo是移动到给定的坐标点;而MoveBy是从当前坐标点移动给定的坐标点这么多的距离。举个例子,假定精灵当前的坐标点是(x, y),分别给MoveTo和MoveBy指定一个坐标点(x1, y1),那么MoveTo和MoveBy最终的效果分别如下 阅读全文
摘要:
#!/usr/bin/python# -*- coding:utf-8 -*- import osimport json file = open('a.txt','w')for root,dirs,files in os.walk('./'): file.write('root:' + root + 阅读全文
摘要:
https://www.runoob.com/python/python-json.html 阅读全文
摘要:
#!/usr/bin/python# -*- coding:utf-8 -*- import os os.system('cocos jscompile -s ./dir1 -d ./dir2') 阅读全文
摘要:
#!/usr/bin/python# -*- coding:utf-8 -*- import shutil #shutil.copy(文件1,文件2)#将源内容复制到目标文件中。d.txt不存在则创建,存在则复制内容到d.txt 如不对文件重命名则文件2改为文件2的上级目录 例:shutil.cop 阅读全文
摘要:
#!/usr/bin/python# -*- coding:utf-8 -*- import os import shutil os.remove(path) #删除文件shutil.rmtree(path) #删除文件夹及其子 可为'./dir' 也可'dir' 阅读全文
摘要:
#!/usr/bin/python# -*- coding:utf-8 -*- import os fileName1 = 'a.txt'if os.path.exists(fileName1): file1 = open(fileName1,'w') file1.write('file1 exis 阅读全文
摘要:
#!/usr/bin/python# -*- coding:utf-8 -*- #!/usr/bin/python# -*- coding:utf-8 -*- file1 = open('a.txt','r')str = file1.read()file2 = open('b.txt','w')fi 阅读全文
摘要:
#!/usr/bin/python# -*- coding:utf-8 -*- open('a.txt','w+') 阅读全文