我的特定功能/命令开始表现异常。 Remove items from a nested list based on comparing values obtained from another nested list
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="form">
<div class="error-msg username">
Please enter your user ID in email format (name@domain.com).
</div>
<div class="error-msg password">
Please enter your password.
</div>
<div class="error-msg up-error">
Incorrect user ID or password. <br> Please type the correct user ID and password, and try again.
</div>
<div class="form-group">
<label for="userName">USER NAME</label>
<input type="text" class="form-control" id="username" name="username">
</div>
<div class="form-group">
<label for="pwd">PASSWORD</label>
<input type="password" class="form-control" id="password" name="password">
</div>
<button type="submit" id='btnValidate' class="btn btn-block btn-primary">SIGN IN</button>
</div>
预期输出:
a = [[1,2,3,4,5],[3,4,5,6,7,8,9],[5],[1,2,3,6,7,8,9]]
b = [[1,4],[6,9]]
print ([[i for i in s if not any(l <= i <= h for l, h in b)] for s in a])
IDLE和codekulptor(https://py3.codeskulptor.org/)中的输出:
[[5], [5], [5], []]
Spyder IDE(在Ipython控制台中)的输出为
[[5], [5], [5], []]
代码运行良好,直到昨天EoD。我今天重新启动了笔记本电脑,开始出现这种差异。我的python安装是通过Anaconda实现的。 Python版本3.6.6(在IDLE和Spyder中均显示)Spyder版本为3.3.1
作为最后的尝试,我尝试过几次重启笔记本电脑,但似乎找不到这种差异的原因
答案 0 :(得分:1)
(这里是 Spyder维护程序),如果我在运行代码之前,可以重现在Spyder中看到的输出
from numpy import any
由于您声称在内核重启后得到的结果相同,所以这意味着您已经激活了其中的选项
Tools > Preferences > IPython console > Graphics > Automatically load Pylab and NumPy modules
因此,请停用该选项,以使用内置的any
获得预期的输出。