Check sibling questions

Write a statement to write the string “Welcome! Please have a seat” in a file wel.txt, that has not yet been opened.



f1 = open ("wel.txt", 'w') 

f1.write ("Welcome! Please have a seat") 


  • f1 is the file object.
  • open( ) method opens the file for writing to it.
  • “wel.text” is the file name.
  • ‘w’ is the access mode ie., the file is opened to write to it. 
  • write( ) method writes the specified string to the file.

Introducing your new favourite teacher - Teachoo Black, at only ₹83 per month

CA Maninder Singh's photo - Expert in Practical Accounts, Taxation and Efiling

Made by

CA Maninder Singh

CA Maninder Singh is a Chartered Accountant for the past 12 years. He also provides Accounts Tax GST Training in Delhi, Kerala and online.