
Loading…

Everything this lesson covers — Introduction, File Operations, Check Path Existence & Type, Folder Creation, Listing Directory Contents and Rename and Delete — in one visual map. Click any topic to open it, or download the full map as an image for revision.
Mind map
Click a topic to open or close it · drag to move · scroll to zoom · the download includes every topic, fully expanded
print("Done")file_path = Path("student.txt")file_path.touch()print("File created sucessfully")file_path.write_text("CodeWithMunnaX")print("Data Written")print(file_path.read_text())file_path.exists()file_path.is_file()folder_path = Path("Videos")folder_path.is_dir()folder_path = Path("C-Programming")folder_path.mkdir()exist_ok=True to prevent error if existsfolder_path = Path("C-Programming/Array/LinkList")folder_path.mkdir(parents=True, exist_ok=True)for item in folder_path.iterdir():print(item.name)for item in Path(".").glob("*.txt"):print(item.name)for item in folder.rglob("*.py"):print(item.name)old_path = Path("teacher.txt")new_path = Path("master.txt")old_path.rename(new_path)new_path = Path("Videos/master.txt")old_path.rename(new_path)file_path = Path("student.txt")file_path.unlink()Path.cwd()current_path.resolve()info = file_path.stat()print(info.st_size)