Skip to content

Python comes with a built-in function that can read, write and create files. You can use it to even create text files or append any data to your chosen file. If you like, you can equally use Python to read files from one line to another.

The File Modes in Python make the program even more interesting than ever. In the remaining part of this write-up, we will teach you some very exciting things about Python and how to use it for opening a file.


How to open a file with Python

First of all, you have to use read mode.

Bear in mind that contents of Python are available in the .txt file and the file to be opened in Python will be opened in this format. The following steps can guide you through the process involved.


  • First of all, open the file in the Read mode by using the code: f = open ( “filename.txt”, “r”)
  • Next, you should use the mode function in that code provided above and this will help you to check if the file is available in the open mode or not. If it is available in the open mode, you can go ahead with the process. the code to use is if f .mode == ‘r’ :
  • After this, you can use for reading the file data and then storing it in variable content  using this code: contents =f .read ()
  • Afterward, you can then print the contents that you have opened.

Reading the opened text file line by line

As stated above, the files opened with Python can be opened in the .txt format. And the text file can be read line by line if the content of the file is so big that it is difficult to read all. Reading from one line to another helps a lot to prevent any form of complication. Python will help to segregate the data to be read. And present it in a mode that is very easy to read.

First of all, run the code (f1=f.readlines()) and this will help you to read the document or file in question from one line to another. Running that code will help to separate each of the lines from one to another and make the file or document available to you in a format that is readable.

If the line is readable and short, the final outcome will have a similarity to what obtains in the read mode. However, the reverse is the case if the file contains complex data; such a data is not readable and the code given above can make it readable.

Some file modes to take note of in Python

  • ‘+’ mode will help to open a file for writing and reading; writing also translates to updating
  • ‘r’ mode is described as the default mode and it opens the file for reading
  • ‘b’ mode will help to open the file in binary mode
  • ‘w' mode will open the file for writing it can also be used to create a new file if the file fails to open, probably because it does not exist. It can equally truncate the file if it exists.
  • ‘x’ mode will help to create a new file. The operation will fail if the file exists already.
  • ‘a’ mode will help to open the file in the append mode. It will equally create a new file if the file is not in existence.
  • ‘t' mode is the default mode and will get the files opened in the text mode.

In summary, you can use the readlines functions in Python for reading the content of a document or file one after the other. You can also use the read function for reading the whole contents of the document or file. Furthermore, you can append data to any existing file by using the command open; that is, “Filename”, “a”). the function open ("filename", "w+")creates a file or document; the + commands the Python compiler to create the document or file if that file does not exist already.

Checking if a directory or file exists

Also, you can use Python to check if a directory or file is in existence or not. We can use a built-in library function to carry out this task. You can use any of the following functions to check if that directory or file is in existence or not:

  • os. path.exists()
  • os. path.isdir()
  • os. path.isfile()
  • paathlib.path.exists()

Methods for Python copy file

Python comes with several built-in functions. They can help to copy files easily using the utilities from the Operating System Shell. First of all, you should get the path that leads to the location where you saved the original file in the current directory.

Explanation of the code

First of all, we will check if the “filename.txt” file is in existence or not. If it is in existence, then we will proceed with the process. We will then store the file path in the “src” variable since the file exists. After getting the path, we will separate the file name and the path from each other. We can do this by using the split function: path.split on source variable. After executing the code it will create a print out with “file path” and a “file name” separately.

We can then create another copy of the already existing file by using Shutil Module. You can take the file named “filename.txt and add another extension to the end, “.bak” so that the new file name will look like filename.txt.bak.”  The new file with .bak extension will represent the new copy or duplicate of the original file. Next, we are to use the function of the utility's copy to get a duplicate of the original destination. After running the code, you will get a duplicate file bearing the .bak extension and you can find it on the right end of the panel. Always remember that the Copy function can only copy the content of the file without copying any additional information.

More help in Python file handling here


File type: Scalable Vector Graphics

What is SVG

The SVG file extension is used mostly to describe two-dimensional or 2D vector graphics in the XML format. It means Scalable Vector Graphics.
It is the standard format by W3C for vector graphics.
The pieces of data can be embedded in a specified Web page or may be stored or saved on their own file.
However, the SVG files are not always compatible with all Web browsers. Also these kind of files can be animated or static images.

How to open a .SVG File

Category: Vector Image
File format: Propriety
Open with Windows: Compatible Web browser, Corel SVG Viewer, Inkscape, Adobe Flash Player, Adobe Flash Player, Corel Paint Shop Pro, Microsoft Visio, Adobe SVG Viewer, Corel Draw graphics suite.
Open with MAC: web browser, Adobe Ilustrator, GIMP, inkscape
Open with Linux: GIMP, inkscape, web browser, kolourpaint.
The browsers are perfect free viewers. You can view the files online without  downloading it. However, it is not possible to edit.
Since they are in the XML format, the files may be accessed using text editors.
These images are also written as text. These vector images also utilize geographical figures represented by specific mathematical equations.
This is as opposed to the raster images using pixels showed with different colors in order to create images.

How to convert

You can convert online using free converters like autotracer.



This format is also used by GTA and Quake III as game files to save the current progress.


File type: Comic Book RAR Archive

What is .CBR

Invalid file associations could be the result of underlying issues within your Windows PC. It is highly recommended to scan your PC for invalid registry entries, unused processes and other slowdown issues.
It is a renamed RAR file that can be decompressed with any decompression tools. The CDisplay particularly displays the images of the comic book stored in the CBR file. In addition, the CBR file need not be decompressed when this program is used. The files saved in the CBR file extension are PNG, GIF and JPEG files. The pages stored are displayed one or two at a time. Not all the decompression tools will be able to display the comic book images in a book format. Also, there might be extra characters that will be displayed upon decompressing the file when the tool used does not have full support on the CBR file extension.

How to Open CBR Files

Category: Compressed Files
File format: Proprietary
Open with Windows: CDisplay, Smith Micro Stuffit Deluxe-Save 20%
Open with Linux: Comix, other decompression tools
Image files are said to have large sizes when saved on one document that is why the CBR file extension is used. It is to compact the large file sizes of the comic book images and for easy downloading.


What is a File Converter

A file converter is a simple tool that allows the individual to easily compress and convert one or more files with the aid of the contest menu on both mobile devices and desktop computers. Most of the available file converters out there are absolutely free and they mostly come with very light interface, which helps to keep the application pleasant to use. It is interesting to know that the file converter can be customized for easy addition or removal of conversion presets in the files context menus. The customization also makes it easy to edit the existing file to change the conversion options.

If you find your file in a particular format that none of the programs on your computer support or will open, you will find the file converter very useful in this situation. Some file converters are available for free use, while some other ones will cost you some money. The file converter will help to convert the file another format that can be easily opened on your computer. This is a common issue and can be easily resolved by using the file converter.

There are different types of file converters and we will consider some of them in the remaining part of this write-up.

Various types of file converters

Video converter

Video converters are reliable for converting video files from one format to another. Most of the video converters around the place support many popular video formats and they can convert these files to any of the supported formats, some of which are highlighted below:

  • WMV
  • SWF
  • MPG
  • MP4
  • MOV
  • MKV
  • V4V
  • FLV
  • F4V
  • DIVX
  • AVI
  • 3GP

You can also use the file converters to convert BD and DVD movies into any other convenient video format, be it AVI, FLV, MP4 or any other. What is more, video converters can work both on mobile devices and desktop computers.

Audio converter

Audio converters, as the name implies, is a program that can convert audio files from one form to another. Many of the available programs built for this purpose can convert audio files into any of the popular formats, like WMA, WAV, MP3, M4A, OGG, FLAC and so on. You can also trust some audio file converters to extract audio information from video files. Many of the available audio file converters are free to use; many of them are also available as web-based audio converters. As a result, they can be used right inside your web browser without downloading anything. You will, therefore, not end up adding more burdens to your device's storage. Bear in mind that both the web-based and the app-based versions of these audio converters are available both on mobile devices and desktop computers.

Image converter

Image converters are used to convert images from one format to another. There are different types of image converters available online today. You can access them both on your mobile device and desktop computers. Just like any of the file converters already discussed above, image converters can either be web-based or app-based. Many of the available image converters can be sued to convert both common and rare images from one form to another. These image converters are reliable of reconverting images to other formats, like WMF, TIF, RAW, PSD, PNG, PDF, PCX, JPG, ICO, GIF, EMF, BMP and so on.

Many of the available image converters come with the batch operation, which means you can easily convert many files into different formats at the same time. You can get any of the image file converters for free, but you may have to pay for some other ones.

Document converter

Document converters are other types of file converters worthy of consideration. If you have any document that you cannot access on your device and you want to open it, simply get any of the document converters to get the job done. Some document converters can be assessed for free online, while you will be required to pay for some other ones. Funny enough, the free ones can be as useful as the paid ones. The document converters can convert files like presentation, database, spreadsheet and even word processing; these files can be converted to several others. Many of the document converters out there can convert files from one form to another, like XLSX, XLS, WKS, TXT, TIF, PPTX, PPT, PDF, DOCX, DOC and so on. You can also use some document converters to convert image formats to text-based files, which will permit easy editing of the information; this is referred to as Optical Character Recognition.


Other types of file converters

Not all files are documents, images, audios and videos. There are some other types of files that may need to be converted from one form to another by using file converters. Some of the less popular types of file converters are:

  • Disc Image Converter, examples of which are IMG, ISO and so on.
  • Font converters, examples of which are DFONT, OTF, TTF and so on
  • Compressed File Converters, examples of which are CAB, 7Z, RAR and ZIP

There are several other rare file converters aside from the ones mentioned above. Many of them are available for free download, while some other ones are paid file converters. The cost is usually very low. Despite the rare nature of these other file converters, they are accessible both on mobile devices and desktop computers. They can also be accessed as web-based or software-based. It is also important to note that most software-based or app-based file converters are very small in size and will not occupy much space on your device when downloaded.



Before you download any of the file converters, first find out if the source is reliable or not. Some file converters may introduce malware or spyware to your device and this can spell doom for your security and privacy. It is also important to read up reviews about that file converter before you download it. The reviews will give you an idea about the reliability of the file converter. It is not advisable to download it if the reviews are not encouraging.



File Extension ADOBEPASSDB_3

adobepassdb_3 is a format file extension related to the adobe systems software applications.


Open Adobepassdb_3

Try to open this extension with an adobe software for Android


File type: ARJ Compressed File

The ARJ file extension is used by the compression utility to reference the compressed archives generated by the application. ARJ is basically an acronym for Archived by Robert Jung in obvious reference to its developer.

This compression tool first made its way into the IT market during the Disk Operating System days. Up to the earlier versions of the Microsoft Windows Operating System environment.

With the inception of the more advanced Graphical User Interface (GUI) Microsoft Windows 95, the ARJ32 version of the compression tool started. This 32-bit console version remained very popular until the Microsoft Windows 2000 platform.

This compression tool was primarily noted for its creation of highly efficient compressed archive files that support the 16- and 32-bit computing architecture of the Intel processor. ARJ became one of the only two mainstream archiving utilities for the MS-DOS and Microsoft Windows Operating System platforms in the middle of the 1990s.

PKZIP compression utility was the main competitor of the software during that era.


open arj file


How to Open an ARJ File

Category: Compressed Archive
File format: Open-Source
Open with Windows:
  • ARJ,
  • ARJ32,
  • Zipeg
Open with Linux: ARJ for Linux
Some components of the ARJ software that support the ARJ file extension are  under the 5,140,321 U.S. Patent.
Although generally less popular compared to PKZIP, it had a substantial niche in the computer market. Especially for BBS users up to the warez era.
The preference for the use of the ARJ format file is largely attributed to the application's ability to create and handle multiple archive volumes. It does this by splitting huge files into smaller chunks making it suitable for dial-up connections as well as software distribution via floppy disks.
It also has proven to be more powerful in terms of compression capability than PKZIP.
The main limitation of the ARJ compression tool is its lack of support for a graphical user interface remaining mainly command line based despite the introduction of GUI based Operating System platforms.
The application responsible for generating the .ARJ supports the use of long filenames, data damage protection, files version management, and ANSI display handler sequences among others.


File type: Windows Media Video File


File Extension WMV

WMV stands for Windows Media Video and it is a video file format that has been developed by Microsoft Corporation and is a proprietary video format. The WMV format has been based on Microsoft's Advanced Systems Format or ASF format container and it compresses videos with the help of Windows Media Compression. Essentially .ASF files are the encoding that the video files use in the Windows Media Video format files. The WMV format video compression is a very crude compression technique being a completely proprietary compression algorithm it is not easily convertible to other video formats. However it is possible to do so and there are softwares available that do that.


Open File WMV

Category: Data File
File format: Proprietary
Open with Windows: Web browser with the Windows Media Player plugin, Roxio Easy Media Creator, CyberLink PowerDirector, CyberLink PowerDVD, Microsoft's Windows Media Player
Open with Linux:

File type: Adobe Flash Animation File

File Extension FLA

The FLA file extension is employed in the identification of Adobe Flash Animation files which are editable movies or animations created by means of the Adobe Flash. The said files are frequently saved as the SWF file to be used on the Internet. The FLA file is an editable project file saved via the Flash Development application.
The SWF file is a compressed format which could be viewed in a majority of Web browsers using the Flash plugin. The Adobe Flash application is used in the creation of movies or animations and the source content is saved using the FLA file format and then later compiled into the SWF file.
The SWF file could then be played using other Web browsers or media players. In order to open an FLA file, users would have to first install the Adobe Flash application.

Open FLA File

Category: Developer Files
File format: Proprietary
Open with Windows: Adobe Flash
Open with Linux: Adobe Flash
Adobe Flash by Adobe Systems is a software program categorized as an authoring application that allows users to make projects by means of a pre-defined environment. An example could be that of a CD burning program known as NERO, an authoring software application intended to create projects in optical devices such as DVDs and CDs.
Adobe Flash provides users with the capability of creating scenes and animations involving pictures, other animation forms, objects, etc. The files saved from this application have the FLA file extension where users are able to edit the projects at any given time. The published version of the said extension could come in various formats such as HTML, EXE, MOV and so on depending on where or how they are utilized.

File type: Windows System

The SYS extension is used mostly on Windows and MS-DOS platforms by SYStem. Generally, the files with the SYS extension contain executable codes for most hardware device drivers, such as the 1394bus.sys.

These files and documents execute on kernel-mode. This is the highest possible privilege for Microsoft Windows systems. This only means that errors or loopholes can cause great damage to the documents and in worst cases; errors may lead to data loss.


How to Open SYS Files

Category: System Files
Format: Propriety
With Windows: May be viewed with a text editor, Should not be opened manually
With Linux: N/A
Two notable and widely used with this extension are the msdos.sys and config.sys.
However, these two are not the same as the other SYS as these two contain configuration parameters not in executable codes but in text form.
These two are commonly used in MS-DOS with the autoexec.bat for controlling the ways the system is boot up. However, with the modern Windows systems, these  are already considered obsolete are now only utilized for backward compatibility only.

File type: Nero CD/DVD Image file


File Extension NRG

NRG file is used by the Nero CD/DVD software and the same is used as an image file by the software to create an exact copy of the disc. This file can also have the directory of files which can be mounted as a disc and the same can be used for copied or backup of disc. This file is an important file which can be converted to .ISO file using the Nero utility software.


Open NRG File

Category: Disk image (ISO) binary file - This file is the image file which is used for the copy of the CD/DVD
File format: Proprietary
Open with Windows: This file can be opened by Nero disc burning/ authoring software, EZB Systems Ultra ISO and IsoBuster
Open with Linux: N.A.
This is the image file for CD/DVD which is created by the Nero CD authoring software


1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)