Topics
Python File
About this topic: Articles tagged __TAG__
Showing 59 articlesRelated tags
Topics
Articles
Showing 59 articles
How-tos
How to Create a File if Not Exists in Python
This tutorial demonstrates how to create a file if it does not exist in Python
↗
How-tos
How to Replace a Line in a File in Python
This tutorial discusses how to replace a line in a file in Python.
↗
How-tos
How to Get the Filename and a Line Number in Python
Learn how to get the filename and a line number in Python
↗
How-tos
How to Delete Files and Directories Using Python
We can delete files and directories in Python using functions from inbuilt packages like os, pathlib and shutil.
↗
How-tos
How to Copy a File in Python
This article introduces how to copy files in Python by using different shutil methods.
↗
How-tos
How to Check File Size in Python
In Python, the file size can be determined using the os module functions. We can use pathlib library, os.path(), stat function, and file object method to do this.
↗
How-tos
How to Write a List to a File With Python
This tutorial clarifies how to write a list to a file in Python.
↗
How-tos
How to Get File Extension in Python
It demonstrates how to get the file extension in Python.
↗
How-tos
How to Find String in File using Python
The tutorial demonstrates how to search for a string in a text file in Python.
↗
How-tos
How to Read First Line of a File in Python
This tutorial demonstrates how to read the first line of a text file in Python
↗
How-tos
How to Save a Dictionary to a File in Python
This tutorial demonstrates how to save a dictionary to a file in Python
↗
How-tos
How to Clear the Contents of a File in Python
This tutorial demonstrates how to clear the contents of a file in Python.
↗
How-tos
How to Loop Through Files in Directory in Python
This tutorial demonstrates how to loop through the files in a directory in Python
↗
How-tos
How to Python Get Filename Without Extension From Path
This tutorial demonstrates how to get file name without extension from the file path in Python
↗
How-tos
How to Overwrite a File in Python
This article explores various methods to overwrite files in Python. Learn how to use the open() function with w mode, read and overwrite files using r+ mode, utilize shutil modules …
↗
How-tos
How to Write String to a File in Python
There are 2 main methods that can be used to write a string to a file in Python, the file handling and the context manager.
↗
How-tos
How to Move Files From One Directory to Another Using Python
This tutorial demonstrates how to move files from one directory to another using python
↗
How-tos
How to Replace String in File Using Python
This tutorial demonstrates how to replace a string in a file in Python
↗
How-tos
How to Read a File Without Newlines in Python
This tutorial demonstrates how to read a file without newlines in Python.
↗
How-tos
Difference between write and writelines in Python
This tutorial introduces difference between write and writelines in Python
↗
How-tos
How to Save Python Variable to File
This tutorial discusses how to save a variable to a file in Python.
↗
How-tos
How to Read File Into Dictionary in Python
This tutorial discusses how to read file into a dictionary in Python
↗
How-tos
How to Find Files Using Python
We can use the os library, the glob library, or the pathlib library to find a file in Python.
↗
How-tos
How to Delete Line From File in Python
This tutorial discusses how to delete a specific line from a file in Python.
↗
No articles found
Try clearing the filters.