eolas/neuron/942a9988-f5a6-4ae9-be83-000113c8d4f2/File_CRUD_operations_in_Python.md
2024-11-04 16:36:34 +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')