浏览代码

第一次提交

admin 1 年之前
当前提交
a35586b4bb

+ 8 - 0
.idea/.gitignore

@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 30 - 0
.idea/inspectionProfiles/Project_Default.xml

@@ -0,0 +1,30 @@
+<component name="InspectionProjectProfileManager">
+  <profile version="1.0">
+    <option name="myName" value="Project Default" />
+    <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
+    <inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
+      <option name="ignoredPackages">
+        <value>
+          <list size="1">
+            <item index="0" class="java.lang.String" itemvalue="mysqlclient" />
+          </list>
+        </value>
+      </option>
+    </inspection_tool>
+    <inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
+      <option name="ignoredErrors">
+        <list>
+          <option value="N802" />
+          <option value="N801" />
+        </list>
+      </option>
+    </inspection_tool>
+    <inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
+      <option name="ignoredIdentifiers">
+        <list>
+          <option value="int.*" />
+        </list>
+      </option>
+    </inspection_tool>
+  </profile>
+</component>

+ 6 - 0
.idea/inspectionProfiles/profiles_settings.xml

@@ -0,0 +1,6 @@
+<component name="InspectionProjectProfileManager">
+  <settings>
+    <option name="USE_PROJECT_PROFILE" value="false" />
+    <version value="1.0" />
+  </settings>
+</component>

+ 7 - 0
.idea/misc.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (删除开头数字和小数点)" project-jdk-type="Python SDK" />
+  <component name="PyPackaging">
+    <option name="earlyReleasesAsUpgrades" value="true" />
+  </component>
+</project>

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/删除开头数字和小数点.iml" filepath="$PROJECT_DIR$/.idea/删除开头数字和小数点.iml" />
+    </modules>
+  </component>
+</project>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>

+ 8 - 0
.idea/删除开头数字和小数点.iml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PYTHON_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 46 - 0
删除小数点操作.py

@@ -0,0 +1,46 @@
+import os
+import re
+
+
+def rename_files(folder_path):
+    # 遍历指定文件夹及其子文件夹
+    for foldername, subfolders, filenames in os.walk(folder_path):
+        for filename in filenames:
+            # 构建完整的文件路径
+            file_path = os.path.join(foldername, filename)
+
+            # 获取文件名(不含路径)
+            base_name = os.path.basename(file_path)
+
+            # 使用正则表达式保留文件名中的小数点,删除开头的数字
+            new_name = re.sub(r'^\d+', '', base_name, count=1)
+
+            # 构建新的文件路径
+            new_path = os.path.join(foldername, new_name)
+
+            # 避免文件名冲突,添加后缀
+            counter = 1
+            while os.path.exists(new_path):
+                # 文件名已存在,添加后缀
+                new_name = re.sub(r'^\d+', '', base_name, count=1) + ('_' + str(counter) if counter > 1 else '')
+                new_path = os.path.join(foldername, new_name)
+                counter += 1
+
+            # 重命名文件
+            os.rename(file_path, new_path)
+            print(f'Renamed: {file_path} -> {new_path}')
+
+
+# 指定要修改文件名的文件夹路径
+folder_path = '/Users/admin/Downloads/市文旅体局'
+
+# 调用函数
+rename_files(folder_path)
+
+# folder_path = '/Users/admin/Downloads/市文旅体局'
+
+
+
+
+
+