我正在尝试在FinalBuilder 8中使用XCopy文件夹。但是,源文件夹的路径中包含空格并且看起来像这样
\%Server%\ inetpub \ wwwroot \ Payment System \%CurrentProjectAlias%\
当我尝试运行XCopy操作时,我收到错误代码4。 有什么办法可以解决这个问题吗? 谢谢你的帮助。
答案 0 :(得分:0)
正如Alex K所说,你需要用双引号括起路径。
def opt(rets, risk_tol, model, round=3):
noa = len(rets.columns)
guess = noa * [1. / noa,] # equal-weight; needed for initial guess
bnds = tuple((0, 1) for x in range(noa))
cons = [{'type': 'eq', 'fun': lambda x: np.sum(x) - 1.},
{'type': 'ineq', 'fun': lambda x: risk_tol - port_variance(x, rets=rets)}
] + mapto_constraints(rets=rets, model=model)
opt = minimize(port_ret, guess, args=(returns,), method='SLSQP', bounds=bnds,
constraints=cons, tol=1e-10)
return opt.x.round(round)
model = pd.DataFrame(np.array([.08,.12,.05]),
index= set(industry), columns = ['strategic'])
model['tactical'] = [(.05,.41), (.2,.66), (0,.16)]
# Set variance threshold equal to the equal-weighted variance
# Note that I set variance as an inequality rather than equality (i.e.
# resulting variance should be less than threshold).
opt(returns, risk_tol=port_variance([0.2] * 5, returns), model=model)
Out[195]: array([ 0.188, 0.225, 0.229, 0.197, 0.16 ])