import logging import os import random import cv2 import numpy as np from image import read_json # size = np.array([[[500, 501, 502], [600, 601, 602], [100, 101, 102]], # [[500, 501, 502], [600, 601, 602], [100, 101, 102]], # [[500, 501, 502], [600, 601, 602], [100, 101, 102]] # ]) # print(size.shape) # print(size[..., ::-1]) # img, _, _ = read_json("train/dataset-line/2/train_0.json") # img.save('train_0.jpg') # with open('train_463.jpg', 'wb') as f: # f.write(img) # print(int(891.999999)) # # _list = [[1, 2], [2, 3], [3, 4]] # delete_list = [[1, 2]] # # _list.remove(delete_list[0]) # print(_list) # # size = (100, 1024) # image = np.zeros(size[::-1], dtype='uint8') # cv2.imshow("image", image) # cv2.waitKey(0) # image = cv2.imread("8.png") # ret, binary = cv2.threshold(image, 180, 255, cv2.THRESH_BINARY) # print("阈值:", ret) # cv2.imshow("binary", binary) # cv2.waitKey(0) # _image = [[1, 0, 1], # [0, 0, 0] # ] # _image = np.array(_image) # print(np.where(_image >= 1)) # localPath = r"C:\Users\Administrator\Desktop\Test_ODPS\1623857120150.pdf" # max_file_size_mb = 2 # if os.path.exists(localPath): # file_size_mb = int(os.path.getsize(localPath)/1024/1024) # print(file_size_mb) # if file_size_mb >= max_file_size_mb: # print("file size > " + str(max_file_size_mb)) # _str = "*" * 10 # print(_str) print(np.pi / 2) print(np.arctan(1)) print(random.sample([1, 1, 2], 2)) # from bs4 import BeautifulSoup # import pandas as pd # df = pd.read_excel("C:/Users/Administrator/Desktop/pb_screen_increase.xlsx") # for index, row in df.iterrows(): # df.loc[index, "dochtmlcon"] = str(BeautifulSoup(row["dochtmlcon"]).find("div", id="pcontent")) # df.to_excel("C:/Users/Administrator/Desktop/pb_screen_increase_new.xlsx", index=False) dict_stage = {"设计阶段":"设计", "环评阶段":"环评", "施工准备":"监理", "施工在建":"施工"} list_stage_v = [] for k,v in dict_stage.items(): list_stage_v.append("(?P<%s>%s)"%(k,v)) print("|".join(list_stage_v))