尝试在Google表格中使用JOIN命令省略部分单元格吗?

时间:2018-12-19 13:46:49

标签: google-sheets

我正在尝试获取已编号的单元格的内容,并将它们连接在一起(以逗号分隔),并省略数字。例如,单元格A1看起来像这样:1.T,2.G,3.Y,4.S

是否有可能将它们合并到另一个单元格中,使其看起来像这样:T,G,Y,S

将省略数字,仅保留字母,并用逗号分隔。谢谢。

1 个答案:

答案 0 :(得分:0)

例如:

\d

import cv2 import os import numpy as np subjects=["","oja","mom"] #img=cv2.imread('obama.jpg') #function_1 def detect_face(img): gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) face_cascade=cv2.CascadeClassifier('A:/project_face_detection/face_detetion/opencv-files/lbpcascade_frontalface.xml') faces=face_cascade.detectMultiScale(gray,scaleFactor=1.2,minNeighbors=5); if(len(faces)==0): return None,None (x,y,w,h)=faces[0] return gray[y:y+w,x:x+h],faces[0] #function_2 def prepare_training_data(data_folder_path): dirs=os.listdir(data_folder_path) faces=[] labels=[] for dir_name in dirs: if not dir_name.startswith('s'): continue; label=int(dir_name.replace("s","")) subject_dir_path= data_folder_path +"/"+dir_name subject_images_names=os.listdir(subject_dir_path) for image_name in subject_images_names: if image_name.startswith("."): continue; image_path=subject_dir_path + "/" + image_name image=cv2.imread(image_path) cv2.imshow("training on image",cv2.resize(image,(400,500))) cv2.waitKey(100) face,rect=detect_face(image) if face is not None: faces.append(face) labels.append(label) cv2.destroyAllWindows() cv2.waitKey(1) cv2.destroyAllWindows() return faces,labels print("preparing data") faces,labels=prepare_training_data("training_data") print("total faces:",len(faces)) print("total labels:",len(labels)) face_recognizer = cv2.face.LBPHFaceRecognizer_create() face_recognizer.train(faces, np.array(labels)) #function_3 def draw_rectangle(img, rect): (x, y, w, h) = rect cv2.rectangle(img, (x, y), (x+w, y+h), (0, 255, 0), 2) #function_4 def draw_text(img, text, x, y): cv2.putText(img, text, (x, y), cv2.FONT_HERSHEY_PLAIN, 1.5, (0, 255, 0), 2) #function_5 def predict(test_img): img = test_img.copy() face, rect = detect_face(img) label, confidence = face_recognizer.predict(face) label_text = subjects[label] draw_rectangle(img, rect) draw_text(img, label_text, rect[0], rect[1]-5) return img print("Predicting images...") test_img1 = cv2.imread("A:/project_face_detection/face_detetion/test_data/test3.1.jpg") test_img2 = cv2.imread("A:/project_face_detection/face_detetion/test_data/test2.1.jpg") predicted_img1 = predict(test_img1) predicted_img2 = predict(test_img2) print("Prediction complete") cv2.imshow(subjects[1], cv2.resize(predicted_img1, (250, 250))) cv2.imshow(subjects[2], cv2.resize(predicted_img2, (250, 250))) cv2.waitKey(0) cv2.destroyAllWindows() cv2.waitKey(1) cv2.destroyAllWindows() 是所有数字的Perl类。 RE2删除其中任何一个后跟一个点的地方。