ItsMyCode
  • How To
  • Python
    • Basics
    • Advanced
    • Built-In Methods
    • Dictionary Methods
    • String Methods
    • List Methods
    • Date and Time
    • Files and Folders
    • Matplotlib
    • Seaborn
    • NumPy
    • Pandas
    • SciPy
    • Errors and Exception
    • Django
  • R
  • Git
  • Powershell
  • Javascript
  • C#
    • Sitecore
  • Node.js
ItsMyCode

Coding Simplified

  • How To
  • Python
    • Basics
    • Advanced
    • Built-In Methods
    • Dictionary Methods
    • String Methods
    • List Methods
    • Date and Time
    • Files and Folders
    • Matplotlib
    • Seaborn
    • NumPy
    • Pandas
    • SciPy
    • Errors and Exception
    • Django
  • R
  • Git
  • Powershell
  • Javascript
  • C#
    • Sitecore
  • Node.js
541
98
0

Home » Python » Files and Folders

Browsing Category

Files and Folders

13 posts
Python Print To File
  • Python
  • Files and Folders
  • 2 minute read

Python Print to File

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
We always use print statements in Python to display the output in the console or command line terminal. However, sometimes we want to change this behavior to print to a…
View Post
Filenotfounderror [Errno 2] No Such File Or Directory
  • Python
  • Errors and Exception
  • Files and Folders
  • 2 minute read

Python FileNotFoundError: [Errno 2] No such file or directory Solution

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
In Python, when you reference a file, it needs to exist. Otherwise, Python will return a FileNotFoundError: [Errno 2] No such file or directory. In this tutorial, let’s look at…
View Post
How To Rename A File In Python
  • Python
  • Files and Folders
  • How To
  • 2 minute read

How to Rename a file in Python?

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The os module in Python comes in handy in performing any file operations such as reading a file, writing into a file etc.. The rename() method is used to rename…
View Post
How To Get File Size In Python
  • Python
  • Files and Folders
  • How To
  • 3 minute read

How to Get File Size in Python?

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
There are different ways to get file size in Python. We will be using the os module and the pathlib module to check the file size. OS module in Python…
View Post
Python Write Text File
  • Python
  • Files and Folders
  • How To
  • 4 minute read

Python Write Text File

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
Python provides built-in functions to perform file operations, such as creating, reading, and writing files. There are mainly two types of files that Python can handle, normal text files and…
View Post
Python Read Text File
  • Python
  • Files and Folders
  • How To
  • 4 minute read

Python Read Text file

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
Python provides built-in functions to perform file operations, such as creating, reading, and writing files. There are mainly two types of files that Python can handle, normal text files and…
View Post
How To Get Current Directory In Python
  • Python
  • Files and Folders
  • 2 minute read

How to get current directory in Python?

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
In this article, we will take a look at how to get current directory in Python. The current directory is nothing but your working directory from which your script is…
View Post
How To Copy A File In Python
  • Python
  • Files and Folders
  • How To
  • 3 minute read

How to Copy a File in Python?

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
We can copy a file in Python using shutil, os, and subprocess modules. Let’s take a look at each of these modules and the functions it has with examples. Modules…
View Post
How To Create A Directory In Python
  • Python
  • Files and Folders
  • How To
  • 3 minute read

How to Create a Directory in Python?

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The os module is a built-in utility available in both Python 2 and 3 versions, and it provides functions to interact easily with the operating system. The os and os.path modules provide…
View Post
Python - List Files In A Directory
  • Python
  • Files and Folders
  • How To
  • 2 minute read

Python – List Files in a Directory

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
There are several modules available in Python to list files in a directory or folder. Some of the popular ones we can use are os, pathlib, glob, fnmatch, etc. This…
View Post
Python Delete File - Step-By-Step Guide
  • Python
  • Files and Folders
  • How To
  • 3 minute read

Python Delete File – Step-by-Step Guide

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
Python has several built-in modules that allow you to delete a file or remove directories. This tutorial is a step-by-step guide to remove a file or directory using 3 different…
View Post
How To Get File Extension In Python
  • Python
  • Files and Folders
  • How To
  • 2 minute read

How to get file extension in Python?

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
In Python, we can extract the file extension using two approaches. Let’s take a look at each of these with examples. Python get file extension using os module splitext() function…
View Post
How To Check If A File Exists In Python
  • Python
  • Files and Folders
  • How To
  • 2 minute read

How to check if a file exists in Python?

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
When you perform a file operation such as reading from a file or writing content to a file, we need to check if a file or directory exists before doing…
View Post
  • Metrics Converter
  • Sitemap
  • Privacy Policy
  • Cookie Policy
  • Contact Us
541
98
0
0
ItsMyCode
Copyright © 2022· All Rights Reserved