How to create a text file and read it with a code.
Python has been the best language in 2017-18, as people are more dependent on it. Likewise, for creating a file we can simply write some command and then we just have to run the code. When you run the code, it will ask you to enter the name of the file that you want. And then it will make you a file whichever you want.
After creating a file, we have to be sure that it reads as well. For reading any kind of file, you need to make another command especially to read the file. Make sure that creating a file and reading files are different. The command for creating and reading file must be in .py so that python can easily understand it.
As from the given images, you can see how the files are created and how the files are read. It will show you an error if there are no files but if there are then it will only display it.
This project is very simple and easy to use. There are no any Spam or any kind of error which may create a broken file. With the help of this kind of program you can easily create 1000’s of files and can make it read as well.
Things you need to install to run this project:
- You have to install python 2.7 or python3 to run this program.
- You have to pip or pip3 as according to your python version.
- And you have to install python libraries that are os.
- And you can install the library by sudo pip / pip3 install os
Click on below button to download this program: