Python write

In this tutorial you will learn about python write function which is used to write text in file using python programming.

There are two types of file handle by python which are normal text file and binary file.

To write in existing file first we need to open that file with python open(“filename”, “permission”) function with permission like appending and writing.

append(a)- It is used for appending content to the end of file.


f.write("now file has more content")

To open and read file after appending


write(w)- It is used for overwrite any existing content. This parameter will also create file if the specified file does not exist.


f.write("Woops! I have deleted the content")

To open and read file after appending



  1. Introduction to Python
  2. How to install python in your system
  3. Python comments
  4. Python Keywords and identifiers

Control statement and loops:

  1. if statement
  2. if ..else statement
  3. if..elif .. else statement
  4. Nested if..else statement
  5. for loop
  6. while loop
  7. break statement
  8. continue statement
  9. pass statement

Data types:

  1. Python number
  2. Python list
  3. Python String
  4. Python tuple

Python function:

  1. Function in python with examples

Python oops:

  1. Python oops
  2. Python class and object
  3. Constructor in python

For more detail about python visit python official sites

Leave a Reply