eolas/neuron/233bf7c7-59e9-471c-8275-895571468b75/File_CRUD_operations_in_Python.md
2024-11-13 18:22:06 +00:00

402 B

tags created
python
file-system
procedural
Friday, October 25, 2024

File operations in Python

Most create, delete, move etc operations invoke the inbuilt os module.

// Add directory CRUD operations in Python

Renaming files (moving)

import os
os.rename('original-file-name.txt', 'new-file-name.txt')

Deleting files

import os
os.remove('file-name.txt')