小编Ado*_*obe的帖子

如何从CLI获取KDE中所有打开的窗口列表?

有没有办法从CLI获取KDE中所有打开窗口的标题列表?

kde window

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

Python:如何在循环中从`eval`调用`print`?

当我打电话printeval:

def printList(myList):
    maxDigits = len(str(len(myList)))
    Format = '0{0}d'.format(maxDigits)
    for i in myList:
        eval('print "#{0:' + Format + '}".format(i+1), myList[i]')
Run Code Online (Sandbox Code Playgroud)

它给出了一个错误:

    print "#{0:01d}".format(i+1), myList[i]
        ^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)

我试着利用这个,然后重写它:

def printList(myList):
    maxDigits = len(str(len(myList)))
    Format = '0{0}d'.format(maxDigits)
    for i in myList:
        obj = compile(src, '', 'exec')
        eval('print "#{0:' + Format + '}".format(i+1), myList[i]')
Run Code Online (Sandbox Code Playgroud)

但这抱怨i:

NameError: name 'i' is not defined
Run Code Online (Sandbox Code Playgroud)

PS我正在处理 python2.6

python eval

3
推荐指数
2
解决办法
6310
查看次数

无需用户交互即可在 org-mode 表和 table.el 表之间进行转换

我将组织模式表转换为 table.el 表。为此,我选择了表格:

| Option      | Type | Value | Descr        |
| -[no]h      | bool | yes   | Print        |
| -[no]versio | bool | no    | Print        |
| -nice       | int  | 0     | Set t        |
| -[no]v      | bool | no    | Be lo        |
| -time       | real | -1    | Take         |
| -[no]rmvsbd | bool | yes   | Removvirtual |
| sites       |      |       |              |
| -maxwarn    | int  | 0 …
Run Code Online (Sandbox Code Playgroud)

emacs elisp

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

电子邮件的内部链接?

如何在电子邮件中插入内部链接?

这是我在浏览器中打开的html,在gmail中复制粘贴,发送给自己并希望其内部链接正常工作:

<html>
  <body>
    <p><a href="#Title1" title="Click to go to Title 1">Birds</a></p>
    <p><a href="#Title2" title="Click to go to Title 2">Trees</a></p>
    <p><a href="#Title3" title="Click to go to Title 3">Flowers</a></p>
    <h4 id="Title1">Birds</h4>
    <p> There are many different birds. There are... </p>
    <h4 id="Title2">Trees</h4>
    <p> Trees have many different colors and branches... </p>
    <h4 id="Title3">Flowers</h4>
    <p> The Lignum Vitae is the national flower of Jamaica... </p>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

编辑:

我发送以下内容给自己:

<html>
  <body>
    <p><a href="#Title1" title="Click to go to Title 1">Birds</a></p>
    <p><a href="#Title2" …
Run Code Online (Sandbox Code Playgroud)

email hyperlink

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

.emacs循环将一些次要模式分配给某些主要模式

我想将{whitespace和yas/minor-mode}次模式挂钩到某些主要模式.当然,这可以手动完成,但我想要一个循环.所以我试着写下来:

(progn 
(setq modes-to-be-hooked '(lisp-mode-hook rst-mode-hook python-mode-hook emacs-lisp-mode-hook text-mode-hook tcl-mode-hook c-mode-hook fortran-mode-hook))
  (while modes-to-be-hooked
    (setq my-hooks '( yas/minor-mode whitespace-mode ))
      (while my-hooks
         (add-hook '(pop modes-to-be-hooked) '(pop my-hooks)))
  )
)
Run Code Online (Sandbox Code Playgroud)

这个循环的问题是list的最后一个元素是"nil"和(add-hook'nil'nil)给出了一个错误.然后我尝试用if来逃避nils但是它不起作用:

(progn 
  (setq mylist '(a b c))
  (while mylist
        (progn
          (setq temp (pop mylist))
          (if temp (message "%s" temp) (message "It's nil!") )
          (sleep-for 1)
        )
  )
)
Run Code Online (Sandbox Code Playgroud)

打印零:(

emacs

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

KDE:我如何从CLI找到并切换当前的全局键盘布局?

我在KDE上,我需要找出并能够在脚本中切换当前的全局键盘布局.我做了一个研究setxkbmap- 但在这种情况下它没有任何帮助.

layout kde

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

给定的FFTW lib是以单精度还是双精度编译的?

有没有办法检查 - FFTW是以单精度还是双精度编译的?

fftw

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

Emacs:我如何阅读我的键绑定?

我如何阅读读数isearch-mode-mapglobal-map变量?随着C-h v它们以不可读的形式显示.

编辑:

C-h b 在查找键绑定时也很有用.

emacs

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

有没有为python编写的化学数据库?

我写的脚本需要知道锡的原子质量.有没有python数据库有这样的信息?

编辑:

periodictable很好,但有些库更丰富的数据.例如gperiodic程序.

python chemistry

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

替换路径

我想替换路径

(setq myFile "/some/path")
Run Code Online (Sandbox Code Playgroud)

在一个文件中。我尝试用 sed 来做到这一点:

find ./_build/html -type f -name '*.html' | while read myFile; do
    MyFile=`readlink -f "$myFile"`
    sed -i "s/setq myFile [)]*/setq myFile \"$MyFile\"/" sphinx_nowrap.el
    # and then some actions on file
done
Run Code Online (Sandbox Code Playgroud)

和 perl:

find ./_build/html -type f -name '*.html' | while read myFile; do
    MyFile=`readlink -f "$myFile"`
    perl -ne "s/setq myFile .+/setq myFile \"$MyFile\")/" sphinx_nowrap.el
    # and then some actions on file
done
Run Code Online (Sandbox Code Playgroud)

但两者都给出错误。

我读过这个这个还有这个——但无法使其发挥作用。

编辑

这是一个 …

bash perl sed

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

标签 统计

emacs ×3

kde ×2

python ×2

bash ×1

chemistry ×1

elisp ×1

email ×1

eval ×1

fftw ×1

hyperlink ×1

layout ×1

perl ×1

sed ×1

window ×1