小编Kan*_*kit的帖子

for循环列表中的python dict

我不明白为什么这两个陈述不相等.

for item in tree.findAll('item'):
    names = [{
      'id': item.id.string,
      'title': __decodefunction(item.entitle.string)
    }]
Run Code Online (Sandbox Code Playgroud)

它有1项,但如果这些声明

names = [{
    'id': item.id.string,
    'title': __decodefunction(item.entitle.string)
}for item in tree.findAll('item')]
Run Code Online (Sandbox Code Playgroud)

它有6个项目.

我想使用第一个循环,但它没有显示正确的项目数.正确的输出是6项.

python dictionary loops list

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

重启nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

我尝试sudo service nginx restart并显示此错误:

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Run Code Online (Sandbox Code Playgroud)

我认为这是关于这个符号链接?

ln -s ../sites-available/default default
Run Code Online (Sandbox Code Playgroud)

我试试

cd /etc/nginx && grep -R listen *

sites-available/default:        listen 80;
sites-enabled/default:        listen 80;
Run Code Online (Sandbox Code Playgroud)

我如何解决它?

ubuntu nginx

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

跨线程操作无效:控制“statusStrip”从创建它的线程以外的线程访问

我试过这个。 /sf/answers/9944861/

喜欢 toolStripStatusLabel1.InvokeRequired

toolStripStatusLabel1没有InvokeRequired

我也试过这个。 /sf/answers/1108190471/

它像无效参数一样出错

SetTextCallback d = new SetTextCallback(SetText); form.Invoke(d, new object[] { form, ctrl, text });

当我使用 ThreadHelperClass.SetText(this, toolStripStatusLabel1, "This text was set safely.");

但我使用时不会出错 textBox

我的代码有方法等待bool另一个使用线程在后台运行的方法。

Thread t = new Thread(TestRemoteDB);
t.Start();
// In TestRemoteDB() will call updateRemoteDBStatus()
Run Code Online (Sandbox Code Playgroud)

像这样

private void updateRemoteDBStatus(bool successful)
        {
            if (successful)
            {
                toolStripStatusLabel4.Text = "OK!";
                toolStripStatusLabel4.ForeColor = Color.Green;
            }
            else
            {
                toolStripStatusLabel4.Text = "Error!";
                toolStripStatusLabel4.ForeColor = Color.Red;
            }
        }
Run Code Online (Sandbox Code Playgroud)

c# multithreading winforms

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

错误:iptables v1.4.21:icmp:必须指定选项“--icmp-type”

我试图用 iptables 来保护 Smurf 攻击。和

iptables -A INPUT -p icmp -m icmp --icmp-type address-mask-request -j DROP
iptables -A INPUT -p icmp -m icmp --icmp-type timestamp-request -j DROP
iptables -A INPUT -p icmp -m icmp -m limit --limit 1/second -j ACCEPT
Run Code Online (Sandbox Code Playgroud)

当我运行这个命令时

iptables -A INPUT -p icmp -m icmp -m limit --limit 1/second -j ACCEPT
Run Code Online (Sandbox Code Playgroud)

iptables 显示并出现错误

iptables v1.4.21: icmp: option "--icmp-type" must be specified
Run Code Online (Sandbox Code Playgroud)

问题是什么 ?

linux ubuntu firewall iptables

0
推荐指数
1
解决办法
5273
查看次数

标签 统计

ubuntu ×2

c# ×1

dictionary ×1

firewall ×1

iptables ×1

linux ×1

list ×1

loops ×1

multithreading ×1

nginx ×1

python ×1

winforms ×1