Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python batch file rename

def batch_rename(dir_path):
    itemlist = os.listdir(dir_path)
    # 获取目录文件列表
    for item in itemlist:
        # 连接成完整路径
        item_path = os.path.join(dir_path, item)
        print(item_path)
        # 修改文件名
        if os.path.isfile(item_path):
            splitext = os.path.splitext(item_path)
            os.rename(item_path, splitext[0] + "-ShowMeAI" + splitext[1])
Comment

PREVIOUS NEXT
Code Example
Python :: ignore exception decorator 
Python :: string exercise 
Python :: Repetition in code for routes in Flask (or Bottle) 
Python :: Trying to set up flask with nginx and gunicorn 
Python :: how to seperate the script from html template when using jQuery in flask 
Python :: How to solve import errors while trying to deploy Flask using WSGI on Apache2 
Python :: session timeout flask 
Python :: typing effect in python 
Python :: how to import grades into a text file in python 
Python :: shere point file uploading to doc repository python 
Python :: python discord next page 
Python :: ring Delete Item From List 
Python :: ring Using Self.Attribute and Self.Method 
Python :: ring Load Syntax Files 
Python :: django bring specific values first 
Python :: how to access python list 
Python :: Problems with flask bootstrap 
Python :: discord rich presence python 
Python :: python strip txt 
Python :: biodiversity 
Python :: how to make download link in Jupyter appmode 
Python :: matplotlib three dimensional plot 
Python :: tusha 
Python :: delete all historical data django simple history 
Python :: python set prcess name 
Python :: python gpsd client 
Python :: Which function is used to read single line from file? 
Python :: changing correlation encoding values 
Python :: Add extra data to Django notifications model object (extend the notify signal) 
Python :: install cs50 library python 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =