一些总是忘记的function - papatwo/PythonNoob GitHub Wiki

check array size and type


var.shape: row x col
var.size: No. of elements in var
type(var): var type
len(var): var length

array slicing 一个tutorial


arr[1,3]: 1-row number, 3-col number
arr[:,3]: :-all rows, 3-col number
arr[::2]: :-from start to end, :2-slicing step;从头开始slice,每2个step slice一次
arr[2::-1,3]: 2:-from row 3 to end, :-1-slicing step;从row 3开始slice到最后,倒着print

matplotlib plot

f, axs = plt.subplots(2, 2, figsize=(16, 9)) # 2x2 subplots and define figsize
axs[0, 0].imshow(wrap_img) # imshow (1,1)subplot
axs[0, 0].set_title('Original Image', fontsize=18)
plt.show()
⚠️ **GitHub.com Fallback** ⚠️