import os
import os.path
def unify_ext_with_os_path(path):
"""統一目錄下的 .txt 文件名後綴為 .csv
"""
for filename in os.listdir(path):
basename, ext = os.path.splitext(filename)
if ext == '.txt':
abs_filepath = os.path.join(path, filename)
os.rename(abs_filepath, os.path.join(path, f'{basename}.csv'))
for filename in os.listdir(path):
basename, ext = os.path.splitext(filename)
參考文檔python獲取文件名不含後綴名_使用Python高效操作文件,3條超實用的建議分享給你..._weixin_39605997的博客-CSDN博客
Preface API When testing ,Requ
Catalog 1 preface 1.1 Philosop