小编new*_*ife的帖子

在Git中提交时使用emacsclient -t

在我.bash_profile,我用这个:

export EDITOR=emacsclient
alias e='emacsclient -t'
Run Code Online (Sandbox Code Playgroud)

当我使用Git提交更改时,它将打开一个新的emacs窗口,但是emacs --daemon.如何将我的默认Git编辑器设置为启用了t标志的emacs?

git emacs bash shell

13
推荐指数
3
解决办法
5591
查看次数

为什么list.append返回None?

我尝试使用python计算postfix expresion,但它无法工作.我想这可能是一个与python相关的问题,有什么建议吗?

expression = [12, 23, 3, '*', '+', 4, '-', 86, 2, '/', '+']

def add(a,b):
    return a + b
def multi(a,b):
    return a* b
def sub(a,b):
    return a - b
def div(a,b):
    return a/ b


def calc(opt,x,y):
    calculation  = {'+':lambda:add(x,y),
                     '*':lambda:multi(x,y),
                     '-':lambda:sub(x,y),
                     '/':lambda:div(x,y)}
    return calculation[opt]()



def eval_postfix(expression):
    a_list = []
    for one in expression:
        if type(one)==int:
            a_list.append(one)
        else:
            y=a_list.pop()
            x= a_list.pop()
            r = calc(one,x,y)
            a_list = a_list.append(r)
    return content

print eval_postfix(expression)
Run Code Online (Sandbox Code Playgroud)

希望有人可以帮帮我!任何建议都会被批准

python

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

标签 统计

bash ×1

emacs ×1

git ×1

python ×1

shell ×1