我有一个数组列表,我正在从我制作的另一种方法中复制它,但我只需要反转它并将最后一个值交换为第一个值。我曾考虑过这样做,但由于某种原因,Prepend它根本不起作用。RemoveAt正在工作。有没有替代我正在做的事情可以完成这项工作?
List<double> pointy = new List<double>
{
0,
FrameHeight-24,
FrameHeight-24+2,
FrameHeight-24+2,
FrameHeight-24+2-3,
FrameHeight-24+2-3,
FrameHeight-24+2-3+1,
FrameHeight-24+2-3+1+2,
FrameHeight-24+2-3+1+2,
FrameHeight-24+2-3+1,
FrameHeight-24+2-3,
FrameHeight-24+2-3,
FrameHeight-24+2,
FrameHeight-24+2,
FrameHeight-24+2+2,
FrameHeight,
FrameHeight,
0,
0
};
pointy.Prepend(pointy[(pointy.Count) - 1]).ToList();
pointy.RemoveAt((pointy.Count)-1);
pointy.Reverse();
Run Code Online (Sandbox Code Playgroud) 我试图为 404 页创建一个自定义处理程序,但出现此错误。我已经尝试了很多方法,但我的观点似乎不起作用?
handler404 = 'DEMOPROJECT.views.handler404'
handler500 = 'DEMOPROJECT.views.handler500'
Run Code Online (Sandbox Code Playgroud)
def handler404(request, exception, template_name="404.html"):
response = render_to_response('/not-found')
response.status_code = 404
return render(request, response)
def handler500(request, exception, template_name="500.html"):
response = render_to_response('/not-found')
response.status_code = 500
return render(request, response)
Run Code Online (Sandbox Code Playgroud)
ERRORS:
?: (urls.E007) The custom handler500 view 'DEMOPROJECT.views.handler500' does not take the correct number of arguments (request).
System check identified 1 issue (0 silenced).
Run Code Online (Sandbox Code Playgroud) 我有这个代码块
double[] tabHeight = { 16, 10, 15, 20 };
double[] tabMidSectionWA = { 6, 2, 5, 6 };
double[] tabCurveWA = {
(tabHeight[0] - tabMidSectionWA[0]) / 2 ,
(tabHeight[1] - tabMidSectionWA[1]) / 2,
(tabHeight[2] - tabMidSectionWA[2]) / 2 ,
(tabHeight[3] - tabMidSectionWA[3]) / 2
};
Run Code Online (Sandbox Code Playgroud)
是否有(tabheight - tabMid) / 2使用 for 循环或 foreach的公式添加这些值的更简单方法?