python 小功能

a = dist(25).zip
b = a.replace("(","").relpace(")","")
**************************************************************
import sys, os

#win环境判断传入参数是单文件名/带完整路径的文件名,并做处理
arg = sys.argv[1]
sourceDir = "d:\\tmp\\"

if arg.find("\\") > 0:
    packageName = os.path.basename(arg)
    sourceFile = arg
else:
    packageName = arg
    sourceFile = sourceDir + packageName
packageNewName = packageName.replace('(','').replace(')','')
sourceFile = sourceFile.replace("\\","\\\\")    
print(packageName, packageNewName)
print(sourceFile)

Leave a Reply

Your email address will not be published. Required fields are marked *