小编Enu*_*mto的帖子

Sqlite更新无法正常工作 - python

编辑:经过一些测试,我发现它不是失败的addpoint方法.

我正在为一个小型游戏开发一个irc机器人.这种方法将更新数据库中的得分称为"得分",这只是两个玩家.这是一个sqlite数据库.它主要是更新sql无法正常工作.

谢谢

def addpointo(phenny, id, msg, dude):
 try:
  for row in c.execute("select score from score where id = '0'"):
   for bow in c.execute("select score from score where id = '1'"):
    if int(row[0]) == 3:
     phenny.say("Winner is " + dude)
     clear("score") # clear db
     clear("sap") # clear db
    elif int(bow[0]) == 3:
     phenny.say("Winner is " + dude)
     clear("score") # clear db
     clear("sap") # clear db
    else:
     phenny.say(msg)
     s = c.execute("select score from score where id=?", id)
     a = int(s.fetchone()[0]) + …
Run Code Online (Sandbox Code Playgroud)

python sqlite

3
推荐指数
1
解决办法
5523
查看次数

调用Action方法的好方法

我如何调用项目,以便TestAction写出"s.Hello"?现在我什么都不做,它跳过了"action = s .."这一行.

或者是另一种方法吗?由于我不想返回任何代码,我使用Action而不是Func

我刚开始使用Action.

public class Items
{
    public string Hello { get; set; }
}

public class TestClass
{
    public void TestAction(Action<Items> action)
    {
        action = s => Console.WriteLine(s.Hello);
    }

    public TestClass()
    {
        TestAction(b => b.Hello = "Hello world!");
    }
}
Run Code Online (Sandbox Code Playgroud)

c# lambda action func

2
推荐指数
1
解决办法
1685
查看次数

标签 统计

action ×1

c# ×1

func ×1

lambda ×1

python ×1

sqlite ×1