小编tom*_*nez的帖子

Tmux窗口或窗格名称在GNOME终端中不会更改

使用Fedora 25和GNOME终端.我在Ubuntu中使用了Tmux几年,并使用了很长的自定义.tmux.conf文件.最近在Fedora中安装了Tmux和Tmuxinator.

当我打开终端时.我看到标题设置为tom@localhost:~.当我创建一个新的Tmux会话,如tmux new -s panes.窗格的标题仍然是tom@localhost:~.

在Tmux会话中.当我打开一个名称console如此的新窗口时new-window -n console.标题不会改变console并继续说tom@localhost:~.

我想也许tmux没有覆盖标题所以我把它添加到tmux.conf文件中:

set-option -g set-titles on
set -g terminal-overrides "xterm*:XT:smcup@:rmcup@"
Run Code Online (Sandbox Code Playgroud)

那仍然没有做任何事情.

终端设置.我已经Profile/Command/When terminal commands set their own titles开始了Replace initial title.

我无法弄清楚这一点.我在这做错了什么?

gnome-terminal tmux fedora-25

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

BeautifulSoup和Python Lambda

我很难理解这段代码.

我想HTMLBeautifulSoup和提取注释Python3.

鉴于:

html = '''
       <!-- Python is awesome -->
       <!-- Lambda is confusing -->
       <title>I don't grok it</title>
       '''

soup = BeautifulSoup(html, 'html.parser')
Run Code Online (Sandbox Code Playgroud)

我搜索了解决方案,大多数人说:

comments = soup.find_all(text= lambda text: isinstance(text, Comment))
Run Code Online (Sandbox Code Playgroud)

在我的情况下会导致:

[' Python is awesome ', ' Lambda is confusing ']
Run Code Online (Sandbox Code Playgroud)

这就是我的理解:

  • isinstance询问if text是否为实例Comment并返回布尔值.
  • 我有点理解lambda.取text作为参数并评估isinstance表达.
  • 你可以传递一个函数 find_all

这是我不明白的:

  • 什么texttext=
  • 什么textlambda text
  • 从什么参数html …

python beautifulsoup python-3.x

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

在 Python3 中比较 int 和 None 没有 TypeError

我知道比较 int 和 None 类型在 Python3 (3.6.1) 中无效,正如我在这里看到的:

>>> largest = None
>>> number = 5
>>> number > largest
TypeError: '>' not supported between instances of int and NoneType
Run Code Online (Sandbox Code Playgroud)

但在这个脚本中,它没有给出 TypeError。

largest = None
for number in [5, 20, 11]:
    if largest is None or number > largest:
        largest = number
Run Code Online (Sandbox Code Playgroud)

当我使用 python3 运行此脚本时,它运行时不会出现 TypeError。为什么?

python short-circuiting python-3.x nonetype

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

AWS 有手册页吗?

我正在学习 AWS 证书。我通过 SSH 连接到 Amazon Linux EC2。

当我输入man awsman ec2没有得到任何结果时。

我看过 AWS CLI 网站,但我想知道为什么没有 AWS 的手册页。

amazon-ec2 amazon-web-services aws-cli

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