Python
realPolymath
这个作者很懒,什么都没留下…
展开
-
二维数组中寻找3个局部最小点 | Find the 3 most extreme local minima of a 2D surface.
import numpy as npn = int(input())m = np.zeros((n, n), dtype=np.int)for i in range(n): for j in range(n): m[i][j] = input()res = (m <= np.roll(m,1,0)) & (m <= np.roll(m,-1,0)) & (m <= np.roll(m,1,1)) & (m <= np.r.原创 2021-03-17 21:57:35 · 225 阅读 · 1 评论 -
ERROR: Could not build wheels for h5py which use PEP 517 and cannot be installed directly
ERROR: Could not build wheels for h5py which use PEP 517 and cannot be installed directly安装低版本的pip包即可,pip install h5py=='一个低版本号'原创 2020-11-18 09:10:32 · 8559 阅读 · 3 评论 -
[Python Tips] 从list中选择”除某个特定元素之外“的值
Problem: 在编程过程中,需要加入list中除某个特定元素之外的值Solution: 可以通过利用Python中set的差来排除特定元素Example:设有列表 A: A = [ (-1,-1), (-1,+1), (+1,-1), (+1,+1) ] C = (-1,-1) ## 现在需要让C等于列表A中除(-1,-1)之外的值 C = set(A) - {C}...原创 2020-07-28 17:48:48 · 6211 阅读 · 1 评论