filmov
tv
How to Read and Write Files in Python | File Handling Tutorial in Python
Показать описание
This is a tutorial video on how to read and write files in Python. This video covers all the basic concepts required to get started with file handling in Python. File objects in Python can be used to read the contents of a file and also file objects can be used to write or append data into a file.
In this video, we cover all the basic concepts required to get started with handing files in Python. We first look at how to read a file which is stored in our operating system. And then cover the concepts of how to write data into a file and also how to append data into a file.
We check out the different between using write and append in Python.
To open the file, we use context manager as well as the traditional method to open a file. We talk about the advantages of using context manager while opening a file in python and also explain why it is recommended in python to always use context manager when dealing with files.
Timestamps:
00:00 How to Read and Write Files in Python
00:39 How to Read a file in Python
02:55 How to use Context Manager to open a file in Python
07:16 How to Write a file in Python
09:09 How to Append a file in Python
10:20 Program to read a file and append data to another file
13:17 How to access files in different path in Python
In this video, we also talk about to how to read a file which is present in different paths or directories. By providing absolute path or relative path to the file we can tell python to look for the desired file in that specific location. However, we can also change the current working directory to point at the path where our desired file is placed.
If path is not mentioned, then Python always looks for the file in the current working directory. However, we can change the current working directory so as to point it to the location where our desired file is placed.
Alternatively, we can also provide the directory path of the file which we are trying to read. We can specify a path in two ways, one is by specifying the absolute path and second is by specifying the relative path.
In this video, we talk about relative and absolute path and also show how you can extract the current working directory and also how you can change the current working directory.
Hope you learnt something from this video. If yes, then please make sure to like and share the video with friends and colleagues who may be interested in learning about files in python.
Also, please do not hesitate to leave a comment if you have any questions related this topic. I would truly appreciate your feedback on this video in the comments section.
Finally, it would really help if you can subscribe to the channel and stay tuned for more useful video’s.
I hope this video was helpful and gives you a good understanding of regular expressions in python. If you liked what you saw, then please make sure to like, subscribe and comment any feedback you may have.
Also please do not hesitate to share the video with your friends and colleagues who may be interested in learning regular expression in python.
🔴 WATCH MORE VIDEOS HERE 👇
✅ SQL Tutorial - Basic concepts:
✅ SQL Tutorial - Intermediate concepts:
✅ SQL Tutorial - Advance concepts:
✅ Practice Solving Basic SQL Queries:
✅ Practice Solving Intermediate SQL Queries:
✅ Practice Solving Complex SQL Queries:
✅ Data Analytics Career guidance:
✅ SQL Course, SQL Training Platform Recommendations:
✅ Python Tutorial:
✅ Git and GitHub Tutorial:
✅ Data Analytics Projects:
THANK YOU,
Thoufiq
In this video, we cover all the basic concepts required to get started with handing files in Python. We first look at how to read a file which is stored in our operating system. And then cover the concepts of how to write data into a file and also how to append data into a file.
We check out the different between using write and append in Python.
To open the file, we use context manager as well as the traditional method to open a file. We talk about the advantages of using context manager while opening a file in python and also explain why it is recommended in python to always use context manager when dealing with files.
Timestamps:
00:00 How to Read and Write Files in Python
00:39 How to Read a file in Python
02:55 How to use Context Manager to open a file in Python
07:16 How to Write a file in Python
09:09 How to Append a file in Python
10:20 Program to read a file and append data to another file
13:17 How to access files in different path in Python
In this video, we also talk about to how to read a file which is present in different paths or directories. By providing absolute path or relative path to the file we can tell python to look for the desired file in that specific location. However, we can also change the current working directory to point at the path where our desired file is placed.
If path is not mentioned, then Python always looks for the file in the current working directory. However, we can change the current working directory so as to point it to the location where our desired file is placed.
Alternatively, we can also provide the directory path of the file which we are trying to read. We can specify a path in two ways, one is by specifying the absolute path and second is by specifying the relative path.
In this video, we talk about relative and absolute path and also show how you can extract the current working directory and also how you can change the current working directory.
Hope you learnt something from this video. If yes, then please make sure to like and share the video with friends and colleagues who may be interested in learning about files in python.
Also, please do not hesitate to leave a comment if you have any questions related this topic. I would truly appreciate your feedback on this video in the comments section.
Finally, it would really help if you can subscribe to the channel and stay tuned for more useful video’s.
I hope this video was helpful and gives you a good understanding of regular expressions in python. If you liked what you saw, then please make sure to like, subscribe and comment any feedback you may have.
Also please do not hesitate to share the video with your friends and colleagues who may be interested in learning regular expression in python.
🔴 WATCH MORE VIDEOS HERE 👇
✅ SQL Tutorial - Basic concepts:
✅ SQL Tutorial - Intermediate concepts:
✅ SQL Tutorial - Advance concepts:
✅ Practice Solving Basic SQL Queries:
✅ Practice Solving Intermediate SQL Queries:
✅ Practice Solving Complex SQL Queries:
✅ Data Analytics Career guidance:
✅ SQL Course, SQL Training Platform Recommendations:
✅ Python Tutorial:
✅ Git and GitHub Tutorial:
✅ Data Analytics Projects:
THANK YOU,
Thoufiq
Комментарии