- 博客(5)
- 收藏
- 关注
原创 python批量转换图片格式:JPEG到jpg
import osimport stringdirName = 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 1175
原创 python批量去掉xml文件的头部
#!/usr/bin/pythonimport osdef 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 1143
原创 获取两个字符串中最大相同子串
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 217
原创 查找字符串中子串出现的次数
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 306
原创 去除字符串两端的空格
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 146
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人