Python переименовать файл
import os
os.rename('guru99.txt','career.guru99.txt')
Cirex
import os
os.rename('guru99.txt','career.guru99.txt')
import os
os.rename('old_name.txt','new_name.txt')
# input and output folder names and path
src_folder = r"C:/Projects/Python/ImageConverter/Image/"
dst_folder = r"C:/ConvertedImages/"
# Search files with .pdf extension in source directory
pattern = "\*.pdf"
files = glob.glob(src_folder + pattern)
# move the files with pdf extension
for file in files:
# extract file name form file path
file_name = os.path.basename(file)
file_name = file_name.replace('.jpg', '')
shutil.move(file, dst_folder + file_name)
print('Moved:', file)
import os
os.rename(r'C:\Users\Ron\Desktop\Test\Products.txt',r'C:\Users\Ron\Desktop\Test\Shipped Products.txt')