wocaosinima 发表于 2017-4-29 15:20:34

自己写的第一个python程序

  写了第一个python程序,感觉很爽。

files = []
file_object = open('G:\_python\package.txt')
try:
for line in file_object:
line = line.rstrip()
if line.endswith('.js'):
= line.split(',')
ns = obj_name.split('.')
if file_name.startswith('//'):
full_name = 'app//%s' % file_name
else:
if len(ns) == 4:
full_name = 'app//%s//%s//%s' % (ns,ns,file_name)
else:
full_name = 'app//%s//%s' % (ns,file_name)
if full_name not in files:
files.append(full_name)
finally:
file_object.close()
print files
print tuple(files)

   package.txt中的内容如下:

MainObjectName,FileName
Divo.app.ChangePassword,ChangePassword.js
Divo.app.ChangePassword,/common/form/passwordfield/js/Ext.ux.PasswordField.js
Divo.app.ChangePassword,/common/form/passwordfield/js/Ext.ux.PasswordField.js
Divo.app.misc.Support,Support.js

 
页: [1]
查看完整版本: 自己写的第一个python程序