几个代码记录一下

Posted liangblog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了几个代码记录一下相关的知识,希望对你有一定的参考价值。

# -*- coding: utf-8 -*-

import traceback
import re
import os

def main(path = poco-gzh-33528,size = 3500):
    dirs = os.listdir(path)
    list_f = []
    num = 0
    count = 0 
    for f in dirs:
        if count == int(size) * num:
            num = num + 1
            if not os.path.exists(path+_page_+str(num)):
                os.mkdir(path+_page_+str(num))
        os.rename(path+/+f,path+_page_+str(num)+/+f)
        count = count + 1
    print(len(list_f))

def rename(path = poco):
    dirs = os.listdir(path)
    num = 0
    count = 0 
    for f in dirs:
        num = num + 1 
        try:
            os.rename(path+/+f,path+/v+str(num)+.jpg)
        except:
            pass
    print(num)
 
if __name__ == __main__:
    path = input(输入路径:)
    #size = input(输入大小:)
    #main(path,size)
    rename(path)
@echo off

setlocal EnableDelayedExpansion
setlocal ENABLEEXTENSIONS
setlocal

cd %1
for %%c in (./*.jpg) do (
   echo %%~nxc
   del /q/a/f/s %%c
   rem ffmpeg -y -i %sourpath%%%~nxc -i %pngpath% -filter_complex overlay=0:H-h  %destpath%%%~nxc
)
pause
@echo off

setlocal EnableDelayedExpansion
setlocal ENABLEEXTENSIONS
setlocal

set pngpath=G:studycodepythoncodecatchImggzh-small.png

set sourpath=G:studycodepythoncodecatchImggank-685set destpath=G:studycodepythoncodecatchImggank-gzhif not exist %destpath% (
    md %destpath%
)
echo %sourpath%
for %%c in (%sourpath%*.jpg) do (
   rem echo %%~nxc
   rem echo %outfile%
   ffmpeg -y -i %sourpath%%%~nxc -i %pngpath% -filter_complex overlay=0:H-h  %destpath%%%~nxc
)
pause
ffmpeg -threads 2 -y -r 10 -i v%d.jpg -i ../audio.mp3 -absf aac_adtstoasc output.mp4

 

以上是关于几个代码记录一下的主要内容,如果未能解决你的问题,请参考以下文章

创建自己的代码片段(CodeSnippet)

几个代码记录一下

latex在vim中的代码片段

QT 实用代码片段

分享几个实用的代码片段(附代码例子)

分享几个实用的代码片段(附代码例子)