编写此声明的任何其他方式

时间:2017-05-20 11:39:30

标签: python bottle pysqlite

我试图以其他方式写这个陈述。

True if 'sessionid' in request.cookies else False

请帮助我。

1 个答案:

答案 0 :(得分:-2)

也许你正在寻找这样的东西:

function start() {
    document.getElementById("task").innerHTML="Task 8";
    var arrNames = [];
    var arrToys = [];
    var vName = "";
    var vToys = "";
    vName = prompt("Enter dog name (leave blank to stop)");
    vToys = prompt("Enter dogs toys (leave blank to stop)");
    while (vName.length > 0) {
        arrNames.push(vName);
        arrToys.push(vToys);
        vName = prompt("Enter dog name (leave blank to stop)");
        vToys = prompt("Enter dogs toys (leave blank to stop)");
    }
    var vOutput = "Dog names and No. of toys: <br/>" + arrNames.map((name, i) => `Dog ${i + 1} Name: ${name}`).join("<br/>") + arrToys.map((name) => `   No. of Toys: ${name}`).join("<br/>");
    document.getElementById("output").innerHTML=vOutput;
}

只是

if 'sessionid' in request.cookies:
    return True
else:
    reutrn False

您也可以将其分配给变量而不是将其返回。