- 博客(5)
- 收藏
- 关注
原创 python批量转换图片格式:JPEG到jpg
import os import string dirName = r"C:\dateset\ImageNet\data\ImageNet2012\ILSVRC2012_bbox_train_v2\Beer\img\\" #最后要加双斜杠,不然会报错 li=os.listdir(dirName) for filename in li: newname = filename newname ...
2020-04-10 14:40:19 1244
原创 python批量去掉xml文件的头部
#!/usr/bin/python import os def listFiles(): fileDir = “C:\Users\it.admin\PycharmProjects\pil” fileList = [] for root, dirs, files in os.walk(fileDir): for fileObj in files: fileList.append(os.path.jo...
2020-04-10 14:36:17 1190
原创 获取两个字符串中最大相同子串
class StringTest { public static String getMaxSubString(String s1,String s2) { String max = “”, min = “”; max = (s1.length()>s2.length())?s1:s2; min = (max==s1)?s2:s1; sop("max="+max+"...min="+...
2020-04-10 14:22:18 247
原创 查找字符串中子串出现的次数
class StringTest2 { //方式一 public static int getSubCount(String str,String key) { int count = 0; int index = 0; while((index = str.indexof(key)) != -1) { str = str.substring(index+key.length()); ...
2020-04-10 14:17:30 364
原创 去除字符串两端的空格
class SrringTest { string sop(String str) { System.out.println(str); } public stctic void main(String [] args) { String s = " abc de "; sop("("+s”)"); s = myTrim(s); sop("("+s")"); } pu...
2020-04-10 14:15:46 175
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人