使用反向参数创建函数的Python代码

时间:2019-01-21 18:22:25

标签: python

如何编写一个返回前一个函数的相反参数的函数?该函数可以返回int,char,string等。示例: f = pow(2,3)= 8(原始) g = pow(3,2)= 9(反向参数)

capitalize_first_and_join第一,第二,第三= FIRSTsecond,第三(原始) capitalize_first_and_join第一第二第三= THIRDsecondfirst(反向参数)

最好与编码器连接,您=编码器,最好,那个,您(原始) join_with最好的编码器是您=您,最好的编码器(反向参数)

我需要创建的函数名称为reversed_args(f)

此致

var can;
var ctx;

function init(){
  can=document.getElementById("Canvas");
  ctx=can.getContext("2d");
  ctx.canvas.width  = window.innerWidth;
  ctx.canvas.height = window.innerHeight;
  DrawSlope(1,20);
}

function DrawSlope(x,y)
{
   var firstPoint = [x,0];
   var secondPoint = [1,x+y];

WritePointToHTML(firstPoint[0],firstPoint[1],secondPoint[0],secondPoint[1]);
}

function WritePointToHTML(x,y,xTwo,yTwo)
{
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(xTwo, yTwo);
ctx.stroke();
}

1 个答案:

答案 0 :(得分:0)

这对代码应该有帮助:

ERROR: Complete output from command /usr/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'

 ERROR: running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/httplib2
    copying python2/httplib2/iri2uri.py -> build/lib/httplib2
    copying python2/httplib2/certs.py -> build/lib/httplib2
    copying python2/httplib2/__init__.py -> build/lib/httplib2
    copying python2/httplib2/socks.py -> build/lib/httplib2
    copying python2/httplib2/cacerts.txt -> build/lib/httplib2
    running install_lib
    creating /Library/Python/2.7/site-packages/httplib2
    error: could not create '/Library/Python/2.7/site-packages/httplib2': Permission denied