我正在尝试设置一个稍微定制的Spyder版本.当Spyder启动时,它会自动导入一长串模块,包括来自matplotlib,numpy,scipy等的东西.有没有办法将我自己的模块添加到该列表中?
如果它有所作为,我正在使用Python(X,Y)Windows安装程序提供的Spyder配置.
numpy的这种奇怪之处是什么原因all
?
>>> import numpy as np
>>> np.all(xrange(10))
False
>>> np.all(i for i in xrange(10))
True
Run Code Online (Sandbox Code Playgroud) 我有一个名为bag的列表.我希望能够检查是否只有特定的项目.
bag = ["drink"]
if only "drink" in bag:
print 'There is only a drink in the bag'
else:
print 'There is something else other than a drink in the bag'
Run Code Online (Sandbox Code Playgroud)
当然,在那里我把'only'放在那里的代码中,这是错误的.有没有简单的替代品?我试过几个相似的词.