常识笔记记载

#  !/usr/bin/python 是告诉操作系统执行这个脚本的时候,调用 /usr/bin 下的 python 解释器。
#   #!/usr/bin/env python 这种用法是为了防止操作系统用户没有将 python 装在默认的 /usr/bin 路径里。
import os
from PIL import Image
# path = os.getcwd()
# print(path)
# import matplotlib.pyplot as plt
# str.zfill(width)  右對齊  不夠補充0
imagelist = os.listdir('/home/who/TEST/data1/')
rootdir = "/home/who/TEST/data1/"
f=open("train.txt","w")
for i in range(len(imagelist)):
    img = Image.open(rootdir + imagelist[i])
    loc = rootdir + imagelist[i]
    s = loc.split("/", 4, )[-1]
    w=os.path.join("./" + s+"\n")
    f.write(w)
f.close()

import os
class BatchRename():
    def __init__(self):
        self.path = r'F:\Program Files\DAUM\PotPlayer\Capture'
    def rename(self):
        filelist = os.listdir(self.path)
        total_num = len(filelist)
        i = 0
        for item in filelist:
            if item.endswith('.jpg'):
                src = os.path.join(os.path.abspath(self.path), item)
                dst = os.path.join(os.path.abspath(self.path), str(i) + '.jpg')
                try:
                    os.rename(src, dst)
                    print(r"converting {src} to {dst} ...")
                    i = i + 1
                except:
                    continue
        print(f'total {total_num}to rename & converted {i} jpgs')

if __name__ == '__main__':
    demo = BatchRename()
    demo.rename()

程序有个问题 遇到空格就stop


    ifstream in("train.txt");
    string filename;
    string  line;

    if(in) 
    {
        while (getline (in, line)) 
        { 
        std::string path =line;
           cout<<line<<endl;
          //  int index = path.find_first_of("/",13);
          //std::string extendName  = path.substr(index+1, -1);
          
          }
      
    } 
上传整个项目
1. 注册登录Github --- Start a project --- 复制SSH key
2. 打开Git终端 --- 登录
3. 创建git配置文件: cd 目标文件夹 --- git init
4. 添加目录下所有文件到本地Git库 --- git add .
5. 提交到本地Git库 --- git commit -m '此次提交注释'
6. 关联服务器Git库(git@github.com:tyyecec/EczomFrame.git改为刚刚复制的SSH key) --- git remote add origin git@github.com:tyyecec/EczomFrame.git
7. 推送到服务器Git库 --- git push -u origin master --- 上传成功
如果服务器Git库不为空将产生冲突,删除服务器内容,或使用 --- git push -f origin master --- 强制上传


上传修改
1. 查看当前分支 --- git branch
2. 创建分支 --- git branch 分支名
3. 切换分支 --- git checkout 分支名
23可合为一步,创建并切换分支 --- git checkout -b 分支名

4. 查看修改文件及内容 --- git diff --- git status
5. 添加所有修改到本地Git库 --- git add .
6. 提交到本地Git库 --- git commit -m '此次提交注释'
7. 推送到服务器Git库 --- git push origin 分支名 --- 上传成功

合并分支
1. 切换到master --- git checkout master
2. 把分支合并到master --- git merge 分支名
3. 无误后删除分支 --- git branch -d 分支名

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值