相关文章:双击osx打开ipython笔记本
如何双击打开Ipython笔记本?我总是cd到笔记本的目录,然后输入ipython notebook浏览器,然后在浏览器中打开它.这个步骤非常不方便.
在Windows中,我记得我可以在浏览器中更改目录,但在linux中没有办法通过浏览器浏览其他目录,如果我想在另一个目录中打开一本新书,我必须重新启动另一个内核,如上所述,这让我很烦.
有没有简单和经过验证的方法来做到这一点?
今天我启用了Gitlab的第二因素身份验证.在那之后,由于我登录了Gitlab网站,我需要用我的手机传递6位数加上我的密码,这很好,这让我觉得安全.
但是,当我使用常规操作时,例如git clone some-repo.git,我收到错误:
Cloning into 'some-repo'...
remote: HTTP Basic: Access denied
remote: You must use a personal access token with 'api' scope for Git over HTTP.
remote: You can generate one at https://gitlab.com/profile/personal_access_tokens
fatal: Authentication failed for 'some-repo.git'
Run Code Online (Sandbox Code Playgroud)
然后我尝试使用现有的克隆本地repo,git pull发生同样的错误.在我启用第二因素身份验证之前,所有上述操作都正常.
根据上述错误说明,我转到了上述地址:https://gitlab.com/profile/personal_access_tokens.我创建了以下标记,并保存标记的密钥.
但是,我不知道如何处理这个密钥.谁能告诉我如何使用此键启用像的基本操作git pull,git clone,git push等...
在启用第二因素身份验证之前,我在本地有很多回购.我希望这些也能奏效.
我正在运行Emacs 24.3和org-mode 8.25f.当我使用Mx org-publish命令时,org-mode只将新的.org文件转换为.html,并跳过自上次发布操作以来尚未修改的所有其他文件.
但是,通常我在发布设置和一些CSS代码更改中有一些更改.我希望它们对所有文件生效,而不仅仅是最近修改过的文件.
那么,我可以告诉org-mode不要跳过这些未更改的文件吗?
我想在组织模式源代码块的源代码注释中插入一个链接。例如:
#+BEGIN_SRC emacs-lisp
;this is the comment part, I want to insert a clickable link here.
#+END_SRC
Run Code Online (Sandbox Code Playgroud)
我尝试过src_org{[[link][description]]},但这不起作用。
我想在sympy中使用jacobDN功能,所以我python setup.py install成功下载了它.
当我想在文档中使用它时:
>>> from sympy.mpmath import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named mpmath
>>>
Run Code Online (Sandbox Code Playgroud)
从sympy导入的所有东西都是成功的:
>>> from sympy import *
>>>
Run Code Online (Sandbox Code Playgroud)
然后我单独安装了mpmath,然后我可以使用mpmath的ellipfun.但是mpf显示出令人讨厌的情况:
>>> from mpmath import *
>>> ellipfun('dn',0.5,0.5)
mpf('0.94297242577738571')
>>>
Run Code Online (Sandbox Code Playgroud)
问题是如何在sympy.mpmath下使用ellipfun?如何检查我的安装漏洞?
以上解决方案是最好的!如果不能,我怎么能像使用普通函数一样在mpmath中使用ellipfun?
-> ~$ pip show sympy
---
Name: sympy
Version: 0.7.7.dev
Location: /usr/local/lib/python2.7/dist-packages/sympy-0.7.7.dev-py2.7.egg
Requires: mpmath
-> ~$ pip install --upgrade sympy
Requirement already up-to-date: sympy in /usr/local/lib/python2.7/dist-packages/sympy-0.7.7.dev-py2.7.egg
Requirement already …Run Code Online (Sandbox Code Playgroud) 考虑下面的代码,乍一看它做了同样的事情,但结果不同,有时列表似乎是按值传递,有时列表似乎是按引用传递:
lst = [1, 2]
def f(lst):
# lst = lst + [3] # seems pass by value
# lst += [3] # strange! same as above but seems pass by reference
lst = lst.append(3) # seems pass by reference
return lst
f(lst)
print(lst)
Run Code Online (Sandbox Code Playgroud)
谁能告诉我发生了什么事吗?
我有一个简单的程序调用std::find_if,我想我已经将前两个参数作为迭代器传递,第三个作为预测传递,但是代码仍然无法编译,任何想法?
#include <string>
#include <cctype>
#include <algorithm>
bool notspace(char ch);
bool space(char ch);
int main() {
typedef std::string::const_iterator iter;
iter i;
std::string s = "ab c";
i = std::find_if(i, s.end(),space);
return 0;
}
bool space(char ch) {
return std::isspace(ch);
}
Run Code Online (Sandbox Code Playgroud)
错误信息:
q-isspace.cpp: In function ‘int main()’:
q-isspace.cpp:12:38: error: no matching function for call to ‘find_if(iter&, std::__cxx11::basic_string<char>::iterator, bool (&)(char))’
i = std::find_if(i, s.end(),space);
^
In file included from /usr/include/c++/5/algorithm:62:0,
from q-isspace.cpp:3:
/usr/include/c++/5/bits/stl_algo.h:3806:5: note: candidate: template<class _IIter, class _Predicate> _IIter …Run Code Online (Sandbox Code Playgroud) 假设我有几个数据帧:df1,df2,df3等.每个数据帧的标签是A1,A2,A3等.我想将这些信息作为一个整体使用,以便我可以传递它们.我想到了三种方法:
使用标签列表:labels=["A1", "A2", "A3"...]和数据帧列表dfs=[df1, df2, df3...].
使用字典:d={"A1": df1, "A2": df2, "A3": df3}.
使用熊猫系列:s=pd.Series([df1, df2, df3], index=["A1", "A2", "A3"]).
我将按顺序使用标签和数据框,因此我认为method1和method3应该是我的选择.但是,使用方法1需要我传递两个项目,而使用方法3我只需要保留一个对象.将数据帧放在一个系列中是一种常见做法吗?我很少看到人们这样做,是不是最佳做法?还有更好的建议吗?
当我转到asyncio页面时,第一个示例是hello world程序。当我在python上运行它时3.73,我看不出与正常的任何区别,有人可以告诉我区别并举一个简单的例子吗?
In [1]: import asyncio
...:
...: async def main():
...: print('Hello ...')
...: await asyncio.sleep(5)
...: print('... World!')
...:
...: # Python 3.7+
...: asyncio.run(main())
Hello ...
... World!
In [2]:
In [2]: import time
...:
...: def main():
...: print('Hello ...')
...: time.sleep(5)
...: print('... World!')
...:
...: # Python 3.7+
...: main()
Hello ...
... World!
Run Code Online (Sandbox Code Playgroud)
我故意将时间从1秒增加到5秒,希望看到一些特别的东西,但我没有。