摘要: # -*- encoding=utf-8 -*- from itertools import combinations,permutations test_data = {'a', 'b', 'c'} # 排列 -- 关注排列方式 print('排列有:{}'.format(list(permuta 阅读全文
posted @ 2020-04-13 08:20 疯狂列表推导式 阅读(270) 评论(0) 推荐(0) 编辑
摘要: ``` # 第一种: number = 11223344556677889900 # 反转1,reverse()方法 # list1 = list(str(number)) # list1.reverse() # 反转2, 切片 list1 = list(str(number))[::-1] print('反转后的', list1) # 删除 # 删除1, 直接remove元素 list1.rem 阅读全文
posted @ 2020-04-13 08:12 疯狂列表推导式 阅读(275) 评论(0) 推荐(0) 编辑
摘要: ``` # -*- coding: utf-8 -*- import cv2 # 读取图片 img = cv2.imread('phone.png') # h、w为想要截取的图片大小 h = 35 w = 170 x = 500 y = 425 cropImg = img[(y):(y + h), (x):(x + w)] cv2.imwrite('test.png', cropImg) ``` 阅读全文
posted @ 2020-04-13 06:52 疯狂列表推导式 阅读(106) 评论(0) 推荐(0) 编辑